Jump to content

Archived

This topic is now archived and is closed to further replies.

manamino

<a onclick=".. not working

Recommended Posts

hi, I have a problem, I have the below code where the table and href shold be inside javascript using document.write
if I put onclick="..." inside the <a > It's not working and I have eror on page after clicking
what 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:

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.