关于函数调用函数的问题
请教以下代码.
第一次单击可以调用到func2();
当第二次单击浏灠器左下角就会报错.提示说需要函数.
还请各位看看这段代码要怎样改正?谢谢!
<SCRIPT language= "javascript ">
<!--
function cg2(va2){
switch(va2){
case 08:
document.all( "SignCheckNo2 ").checked = false;
break;
case 09:
var func2var;
func2var=func2();//呼叫函數
alert(func2var);
if (func2var== "09 ")
{
break;
}
else
{
document.all( "SignCheckNo2 ").checked = true;
document.all( "SignTB22 ").style.display = " ";
break;
}
}
}
function func2()
{
var signmail= "name1 "
var jpcuser= "name2 ";
if (signmail==jpcuser){
alert( "你無權簽核! ");
func2= "09 ";
return func2;
}
else
{
func2= "00 ";
return func2;
}
}
//-->
</SCRIPT>
<form name=form1>
<input type= "radio " name= "SignCheckNo2 " id= "SignCheckNo2 " value= "2 " onclick= "cg2(09) "> 不同意
<table width= "100% " border= "0 " id= "SignTB22 " style= "display:none ">
<tr>
<td width= "150 "> 不同意原因: </td>
<td>
<textarea name= "CancelSign_Reason2 " style= "WIDTH:350px;height:40px " id= "CancelSign_Reason2 "> </textarea>
</td>
</tr>
</table>
</form>
------解决方案--------------------func2= "00 ";
第一次调用后func2就等于一个字符串了,不再是一个函数,当然在第二次时就提示说没有函数! 如果只是可以运行,如下更改就可以:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> New </TITLE>
</HEAD>
<BODY>
<SCRIPT language= "javascript ">
<!--
function cg2(va2){
switch(va2){
case 08:
document.all( "SignCheckNo2 ").checked = false;
break;
case 09:
var func2var;
func2var=func2();//呼叫函數
alert(func2var);
if (func2var== "09 ")
{
break;
}
else
{
document.all( "SignCheckNo2 ").checked = true;
document.all( "SignTB22 ").style.display = "