SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Javascript into html tags
-
Oct 15, 2001, 08:49 #1
- Join Date
- Sep 2001
- Location
- London
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Javascript into html tags
If I've got a variable, say x, how can I get that into a html tag as a parameter?
Basically I want to get the position of the top corner of a layer to be determined in the <HEAD>, and then in the body, have <div id="1234" style="position:absolute; left:"x" px; top:"y" px>
If you see what I mean. Thanks again,
Marek
-
Oct 15, 2001, 12:52 #2
- Join Date
- Oct 2001
- Location
- Whistler BC originally from Guelph Ontario
- Posts
- 2,175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try doing this...
Within the head section
function display(){
document.write("<div id="test" style='left:"+x+"; top:"+y+"; position:absolute>")
document.write("this is whats in the layer")
document.write("</div>")
}
I think that is what you mean...hope that helps...Maelstrom Personal - Apparition Visions
Development - PhP || Mysql || Zend || Devshed
Unix - FreeBSD || FreeBsdForums || Man Pages
They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.
-
Oct 16, 2001, 06:51 #3
- Join Date
- Mar 2001
- Location
- In a van... down by the river.
- Posts
- 366
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally posted by Maelstrom
Try doing this...
Within the head section
function display(){
document.write("<div id="test" style='left:"+x+"; top:"+y+"; position:absolute>")
document.write("this is whats in the layer")
document.write("</div>")
}
I think that is what you mean...hope that helps...
so i think this is what you will need.
Code:document.write("<div id='test' style='left:"+x+"; top:"+y+"; position:absolute'>") document.write("this is whats in the layer") document.write("</div>")
Some say the world will end in fire, Some say in ice.
From what I've tasted of desire
I hold with those who favor fire.
-
Oct 16, 2001, 07:00 #4
- Join Date
- Sep 2001
- Location
- London
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I've already worked it out. Sorry I didn't say so before. Basically I did what you guys said, but didn't think you could do it at first. That's why I didn't try it. I thought you would have to get the details on the clientside, and then change the html serverside, but it works any way.
Code:window.document.writeln('<div id="main" style="position:absolute; left:'+x+'px; top:'+y+'px; width:750px; height:440px; z-index:20">')
Bookmarks