higuy001 Posted August 5, 2009 Share Posted August 5, 2009 Does anyone know the code to change a <div> tag's content? I've tried using function divMath() {var div = document.getElementById("content");var txt = "<A href=\"http://miniwidgit.webs.com/Math.wdgt.zip\">Math Widgit</A><br><input type=\"button\" value=\"Info...\" onClick=\"att();\"><br><a href=\"http://miniwidgit.webs.com/MathLarge.wdgt.zip\">Math Widgit Large</a>";div.value = txt;} but this doesn't work.Am I doing anything wrong? Did I miss a semicolon? Can anyone help? :)HiGuy Link to comment Share on other sites More sharing options...
justsomeguy Posted August 5, 2009 Share Posted August 5, 2009 Use the innerHTML property, not the value property. Link to comment Share on other sites More sharing options...
higuy001 Posted August 5, 2009 Author Share Posted August 5, 2009 Use the innerHTML property, not the value property.That doesn't seem to work though.Is anything else wrong?function divMath() {var div = document.getElementById("content");var txt = "<A href=\"http://miniwidgit.webs.com/Math.wdgt.zip\">Math Widgit</A><br><input type=\"button\" value=\"Info...\" onClick=\"att();\"><br><a href=\"http://miniwidgit.webs.com/MathLarge.wdgt.zip\">Math Widgit Large</a>";div.innerHTML = txt;} <a href="#" onClick="divMath();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','TabLeft2.png',1)"><img src="TabLeft.png" name="Image1" width="100" height="50" border="0"></a> <div name="content"></div> HiGuy Link to comment Share on other sites More sharing options...
Ingolme Posted August 5, 2009 Share Posted August 5, 2009 It's called "getElementById" because you search for the element by the ID.Use this: <div id="content"></div> Link to comment Share on other sites More sharing options...
higuy001 Posted August 5, 2009 Author Share Posted August 5, 2009 It's called "getElementById" because you search for the element by the ID.Use this: <div id="content"></div>Oooohhhhhhhhhhhhhh! :)I SO didn't realize that.Wow.I am dumb. :)Thanks! It works!HiGuy Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.