Sub ErrBreak(WatchValue,StopHere) 'WatchValue:查看的变量值,Stop:是否中断在此函数处,而不管后面代码是否正确 Response.write "<br><B style='background-color:#FF0000;Color:#FFFFFF;Font-si ze:12pt'> "&WatchValue&" <br>" if StopHere=true then Response.End End Sub 以上过程必须放在引用之前,例如: <!--#include file="conn.asp"--> <% Sub ErrBreak(WatchValue,StopHere)'WatchValue:查看的变量值,Stop:是否中断在此函 数处,而不管后面代码是否正确 Response.write "<br><B style='background-color:#FF0000;Color:#FFFFFF;Font-si ze:12pt'> "&WatchValue&" <br>" if StopHere=true then Response.End End Sub ErrBreak Conn,true '查看Conn的值,并在此处断点,VB调用函数或过程时不能使用(), '要使用括号必须是要获得返回值或Call来调用,即这里可以写成 'Call ErrBreak(Conn,true) '如果这里的true改为false,这里就不执行中断。如果采用了中断, '就可以忽略后面的错误 %>
function test(sFun)
{
if(typeof(sFun)=="string")
try {eval(sFun)} catch(e) {alert(e.)}
}通过test这个函数作为接口运行其他函数。
<script>
function yourFunction()
{alert()
……
……
}
</script>
function catchError(m){
try{
eval(m).value='fason'
}
catch(e){
alert(e.name+'\n'+e.description+'\n'+e.message+'\n'+e.number)
}
}
catchError('fason')
</script>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD><script>
window.onerror = function(s,u,l){
try
{
alert(u+"中\n\n"+l+"行\n\n发生了错误:"+s);
}catch(e){}
//to avoid IE handle it.
event.cancelBubble = true;
event.returnValue = true;
return true;
}
</script>
<BODY onclick="asdf">
<!--BODY onclick="throw 'exception not catched'"-->
<P> </P></BODY>
</HTML>
'WatchValue:查看的变量值,Stop:是否中断在此函数处,而不管后面代码是否正确
Response.write "<br><B style='background-color:#FF0000;Color:#FFFFFF;Font-si
ze:12pt'> "&WatchValue&" <br>"
if StopHere=true then Response.End
End Sub
以上过程必须放在引用之前,例如:
<!--#include file="conn.asp"-->
<%
Sub ErrBreak(WatchValue,StopHere)'WatchValue:查看的变量值,Stop:是否中断在此函
数处,而不管后面代码是否正确
Response.write "<br><B style='background-color:#FF0000;Color:#FFFFFF;Font-si
ze:12pt'> "&WatchValue&" <br>"
if StopHere=true then Response.End
End Sub ErrBreak Conn,true
'查看Conn的值,并在此处断点,VB调用函数或过程时不能使用(),
'要使用括号必须是要获得返回值或Call来调用,即这里可以写成
'Call ErrBreak(Conn,true)
'如果这里的true改为false,这里就不执行中断。如果采用了中断,
'就可以忽略后面的错误
%>
{
……
}
catch(e)
{
alert('error');
}
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD><script>
window.onerror = function(s,u,l){
try
{
alert(u+"中\n\n"+l+"行\n\n发生了错误:"+s);
}catch(e){}
//to avoid IE handle it.
event.cancelBubble = true;
event.returnValue = true;
return true;
}
</script>
<BODY onclick="asdf">
<!--BODY onclick="throw 'exception not catched'"-->
<P> </P></BODY>
</HTML>
try
{
new ActiveXObject("asd");
}
catch(e)
{
alert(e.message);
}
finally
{
}
</script>
{
}
catch (e)
{
alert(e)
}
function catchError(m){
try{
eval(m).value='fason'
}
catch(e){
alert(e.name+'\n'+e.description+'\n'+e.message+'\n'+e.number)
}
}
catchError('fason')
</script>还可以的