谁帮我看看这段asp函数哪错了

来源:百度知道 编辑:UC知道 时间:2024/06/23 18:16:45
<html>
<head>
<title>ASP</title>
</head>
<body>
<input type=text name="outt" onchange="outt1.value = abs1(outt.value)"><input type=text name="outt1">

<script language=vbscript>

function
if n>0 then
abs1= n
else
abs1= -n
end if
end function
</script>
</body>
</html>

function FN
if n>0 then
abs1= n
else
abs1= "-"&n
end if
end function

1) function 没有名字!应该这样
function 模块名(参数)
....这里是代码...
end function
根据你的代码,这里模块名应为:abs1
2) 在 onchange 中应该改为
onchange="vbscript:call abs1()"

最终修改的结果如下:

<html>
<head>
<title>ASP</title>
</head>
<body>
<input type=text id="outt" onchange="vbscript:call asb1()"><input type=text id="outt1">

<script language=vbscript>

function asb1()
n=document.getElementById("outt")
if n>0 then
document.getElementById("outt1")= n
else
document.getElementById("outt1")= -n
end if
end function
</script>
</body>
</html>