Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using <div> tag in document.write

Status
Not open for further replies.

lukeduncalfe

Technical User
Jun 8, 2003
3
NZ
hi,

i've got a problem that has perplexed me for a long time!

background:

i've written some code that positions a transparent flash file (.swf) in a css layer overtop of an html page. then there's some javascript that keeps the layer in the same place on the screen even when you scroll down (works a bit like a watermark).

i'm wanting people to be able to include this snippet of code into their own html to have this flash movie appear overtop of their page, so i'm wanting to package the code as attractively as possible in a .js file, so all people will have to add is a <script src=&quot;&quot;></script> tag to add the code.

here's the problem:

i've managed to get the javascript side of the code successfully into a .js file, but i can't seem to get that css using document.writes! even though logically it should work (one supposes). the css i'm trying to include is:

<div id=interlayer
style=position:absolute;width:'100%';height:'100%';z-index:100;left:1px;top:1px><OBJECT
classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 WIDTH=100% HEIGHT=100% id=x ALIGN=top><PARAM NAME=movie
VALUE= NAME=menu VALUE=false><PARAM NAME=quality VALUE=best><PARAM NAME=scale VALUE=exactfit><PARAM NAME=salign VALUE=T><PARAM NAME=wmode VALUE=transparent></OBJECT></div>

which is at the moment followed by the javascript in a .js file:

<script language=&quot;javascript&quot; src=&quot;
i'd prefer the two to go in the same file, but even two .js files, one with the css and one with the javascript would be great.

if anyone manages to get the css working in a .js file they will be able to tell because on a pc running ie a large red x will appear on screen. try it by putting it in just the html

any help would be appreciated,

luke
 
netscape and macs with ie ignore the transparent bit of the flash file. so instead of having just a drawing in flash appear overtop of the page, you get the whole movie with white background as well (which means you can't see the page underneath).

but for the purposes of the question this won't matter, so if you have any ideas ...

it's strange because i can successfully put a table in a .js file with document.write making it. and i've tried some simple <div> 's, but for some reason when all the code i want is put together it doesn't work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top