Jump to content

document.getElementById().innerHTML


jitz

Recommended Posts

HiI am using a div element which is invisible onLoad.When a button is clicked, it appears.Iwant to add a html page with 2 buttons to appear in this div.So i had used javascript to assign the html tags to a variable and use document.getElementById(divname).innerHTML=variable to get the html page inside the div.It works well in mozilla firefox 1.5.But div is empty in ie.Can somebody help me????My code looks somewhat like this..in main page,<div id="editsidebar" name="edit" style="width:285px; height: 200px;border-width:thin; border-color:black; border-style:solid; overflow:auto; "></div>on body onLoad,onLoad (){ document.getElementById("edit").style.display = 'none';} and in javascript it has var info = '<html><head></head><body bgcolor=#F0F8FF ><div style="white-space:nowrap;" id="content"><form id="form1" ><table width=280><tr></tr><tr><td align=center><font ><b>Enter Details</b></font></td></tr><tr><td> </td></tr><tr><td><font color=#6699CC>Name:</font></td></tr><tr><td><input type="text" size=35 ></input></td></tr><tr><td> </td></tr><tr><td align=center><input class=formButton type="submit" value="Submit" onClick="java script:bookMark();"></input>    <input class=formButton type="button" value="Cancel" onClick="history.go(0)" ></input></td></tr></table></form></div></body></html>'; document.getElementById("edit").innerHTML = infow;Pleez Help me

Link to comment
Share on other sites

inserting HTML, HEAD, aND BODY tags into a DIV is ncorrect syntax anyways....also your last line of code is wrong you use = infow when the variable name in info..Please post the ENTIRE page, knowing every piece of code is important.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...