Jump to content

<a onclick=".. not working


manamino

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:
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.