manamino Posted April 20, 2006 Share Posted April 20, 2006 hi, I have a problem, I have the below code where the table and href shold be inside javascript using document.writeif I put onclick="..." inside the <a > It's not working and I have eror on page after clickingwhat is the problem?[!--coloro:#009900--][span style=\"color:#009900\"][!--/coloro--]<html><head><script language="JavaScript">function submitting(forum){document.write(forum) //this is only a test}function loading(){var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.load("forums.xml");var doc=xmlDoc.documentElement;for(var i=0; i<doc.childNodes.length; i++)display(doc.childNodes(i));}function display(cat){document.write('<a name="top"></a><TABLE cellspacing="1" width="100%" bgcolor="#99ccff" border="2" ><TR><TH bgcolor="#ffff99" COLSPAN="3" ALIGN="LEFT">'+cat.getAttribute("NAME")+'</TH></TR>');document.write('<TR bgcolor="#33cccc" ><TD width="80%">Forum</TD><TD width="10%">Topics</TD><TD width="10%">Replies</TD></TR>');for(var j=0;j<cat.childNodes.length;j++){var node=cat.childNodes(j);document.write('<TR><TD><a href="#top" onclick="submitting(\''+node.childNodes(0).firstChild.text+'\')">'+node.childNodes(0).firstChild.text+'</a><br><FONT COLOR="GRAY">'+node.childNodes(1).firstChild.text+'</FONT></TD><TD>'+node.childNodes(2).firstChild.text+'</TD><TD>'+node.childNodes(3).firstChild.text+'</TD></TR>');}document.write('</TABLE>');}</script></head><body onload="loading()"><form name='forums' action='posts.php' method='post'><input type='hidden' name='forum'/></form></body></html>[!--colorc--][/span][!--/colorc--]but if I tried alert instead of submitting it works: Quote Link to comment https://forums.phpfreaks.com/topic/7919--/ Share on other sites More sharing options...
Ninjakreborn Posted April 28, 2006 Share Posted April 28, 2006 add " at the end of onclick="whatever" Quote Link to comment https://forums.phpfreaks.com/topic/7919--/#findComment-31534 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.