Here's a complete sample code with the error I mentioned just to show you my problem.
Please just copy paste the entire thing and tell me what's wrong.
I'm in a bit hurry
<HTML>
<HEAD>
<meta name=vs_targetSchema content="HTML 4.0">
<TITLE></TITLE>
<META NAME="GENERATOR" Content="Microsoft Visual Studio">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript">
<!--
function a(){
str="2";
c2.innerText="but now it should alert something";
alert("so far so good");
c2.onclick=new Function(str, "b(" + str + ");");
}
function b(obj){
if(obj==2)alert("the onclick changed successfully!");
}
-->
</script>
</HEAD>
<BODY>
<table border="2" bordercolor="#cc3300">
<tr>
<td id="c1" onclick="a();">Sets the onclick of the next cell</td>
<td id="c2" onclick="b('1');">First calls nothing</td>
</tr>
</table>
</BODY>
</HTML>