Old 17-09-2003, 05:20   #1 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,672
Attaching CSS

I am trying to attach a css style sheet to a dynamically generated html page. I'm using the following line of code, but it keeps crashing IE

mainMenu.document.write("<link rel='stylesheet' href='/webnativedoc/images/houseStyles/mainMenu.css' type='text/css'></head>");

Is this line correct or are there some obvious mistakes, there is a lot of other script flying around at the same time but this all works fine without the above line of code.

Any ideas?
  Reply With Quote
Old 17-09-2003, 05:32   #2 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
Should the </head> be in there?
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 17-09-2003, 05:49   #3 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,275
is the root path correct?

dont you need ../

also doesn't stylesheet have to be something like $stylesheet (is it a variable)
  Reply With Quote
Old 17-09-2003, 05:58   #4 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
i'd say the above code is ok. not tested it but, try putting it outside of the head and see if it places it in and doesn't crash ie then. i've got a feelng its b'cos you're trying to document.write to within the header - just a thought
  Reply With Quote
Old 17-09-2003, 06:12   #5 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,672
NB. I'm using a Javascript function to write the whole page dynamically, sorry should have made that clear in the first place.)

The root path I'm using is based around all of the others within the app I'm modifying, and works fine for every other hard coded page I've used. So I'm not sure that I need ../ (though I would normally be using it - I'll give it a go and see, just didn't want to mess with what already worked as far as that went).

Should the stylesheet have to be a variable? I'm not sure. Why would it? do the # etc within the css conflict with the Javascript when read into the new document or something?

It may be that this line of code is fine, but when it's removed the rest works a'ok -though it could be a conflict with something else I guess, but I have no idea what.

The full function (for those wondering) looks something like this...


function mainMenu() {

mainMenu = window.open("/webnativedoc/doc/blank.html", "mainMenu");

mainMenu.document.open("text/html");
mainMenu.document.write("<head><title>Menu Test</title>");
mainMenu.document.write("<link rel='stylesheet' href='/webnativedoc/images/houseStyles/mainMenu.css' type='text/css'></head>");
mainMenu.document.write("<body>");
mainMenu.document.write("<form method='POST' name='search' action='/webnative/searchengine'>");

mainMenu.document.write("<table cellspacing='0' cellpadding='0'><tr>");
mainMenu.document.write("<td class='tabTop' colspan='2'></td></tr>");
mainMenu.document.write("<tr><td class='tabSlope'><img src='images/tabSlant.gif'></td>");
mainMenu.document.write("<td class='tab'>");

mainMenu.document.write("<script type='text/JavaScript'>");
mainMenu.document.write("parent.listContent.basket button2();");
mainMenu.document.write("parent.listContent.passwo rdbutton();");
mainMenu.document.write("parent.listContent.helpbu tton2(parent.mainContent.helpLocation, 'document.search.inwinstrmain');");
mainMenu.document.write("parent.mainContent.search button(parent.mainContent.dir);");
mainMenu.document.write("</script>");
mainMenu.document.write("</td></tr></table>");
mainMenu.document.write("</form>");
mainMenu.document.write("</body>");
mainMenu.document.close();
mainMenu.focus();
}
  Reply With Quote
Old 17-09-2003, 06:14   #6 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,672
Brown - hmm, I've tried that but had a similar effect, I'll give it another shot.

Thanks
  Reply With Quote
Old 18-09-2003, 13:24   #7 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,672
Yup that seems to have fixed the problem, I'm having some more issues but I think I'm just asking it to do too much at once... time to reorder when things get triggered.

Thanks Brown
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8