• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >ASP > javascript asp教程错误处理

javascript asp教程错误处理

作者: 字体:[增加 减小] 来源:互联网 时间:2017-05-11

通过本文主要向大家介绍了javascript asp.net,asp javascript,网页javascript错误,javascript错误,javascript错误处理等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

The ASPError Object has zero (0) Methods, nine (9) Properties, zero (0) Events, and zero (0) Collections.

AspCode
AspDescription
Category
Column
Description
File
Line
Number
Source

The way you access the ASPError Properties is with a Server Method. Yeah, I know; it doesn't make sense. Start with something like var myError=Server.GetLastError() and then you can access all nine ASPError Properties following this pattern: <%=myError.Line%>.

Below is the script for Lesson 15.

<%@LANGUAGE="JavaScript"%>
<!-- METADATA TYPE="typelib" 
FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
try
	{
	Response.Write("<STRONG>Use <I>GetLastError( )</I><BR></STRONG>\r")
	myError = Server.GetLastError()
	Response.Write("myError.Line: " + myError.Line + "<BR>\r")
	Response.Write("myError.File: " + myError.File + "\r")
	Response.Write("<HR>\r<STRONG>")
	Response.Write("Now an intentional error...")
	Response.Write("<BR></STRONG>\r")
	myError = erver.GetLastError() //this line causes an error
	Response.Write("myError.Line: " + myError.Line + "<BR>\r")
	Response.Write("myError.File: " + myError.File + "<BR>\r")
	}
catch(myDumbError) 
	{ 
	Response.Write("There is an error: " + myDumbError)
	%>
	<BR>
	Graceful error handling goes here (inside the catch statement).
	Make it as simple or sophisticated as you like.<BR>
	<HR>
	<STRONG>Now let's break down the error Object.</STRONG><BR>
	<%
	for ( var i in myDumbError)
		{
		Response.Write(i + ": " + myDumbError[i] + "<BR>\r")
		}
	}
finally
	{
	Response.Write("<HR><STRONG>Let's Finish Up.</STRONG><BR>\r")
	Response.Write("Code inside the <I>finally { }</I> statement ")
	Response.Write("executes regardless of error (or lack thereof). \r")
	Response.Write("<I>finally{ }</I> is totally optional. ")
	Response.Write("It's a good place for things like RS.Close()... ")
	Response.Write("which you'll see later on.")
	}
%>

Click Here to run the script in a new window.

Okay, so what happened to On Error Resume Next? Sorry, that ain't no JavaScript thing. So, what about onerror? That won't work on the server side. But thanks to some core JavaScript we have some error handling.

The section of script for which you wish to provide error handling goes inside the try { } statements and the what-to-do in the event of an error goes inside the catch { } statement. There is also a finally { } statement (optional). The whole thing is just as graceful as On Error (in my opinion).

Not every ASP server allows you access to the ASPError Object. So, don't be surprised if ASPError gives you an error.

</div>
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • asp cookie中文Javascript取得中文cookie
  • JavaScript在ASP页面中实现掩码文本框效果代码
  • asp中去除html中style,javascript,css代码
  • asp(JavaScript)自动判断网页编码并转换的代码
  • asp javascript值的互相传递方法
  • asp+javascript实现404页的处理转换
  • ASP之处理用Javascript动态添加的表单元素数据的代码
  • asp编程中常用的javascript辅助代码第1/2页
  • ASP中JavaScript处理复杂表单的生成与验证第1/3页
  • javascript asp教程 日期相关

相关文章

  • 2017-05-11asp 实现视频显示的效果函数
  • 2017-05-11asp 实现当有新信息时播放语音提示的效果
  • 2017-05-11实用301转向到另一域名相应页面的asp代码
  • 2017-05-11解决ASP中http状态跳转返回错误页的问题
  • 2017-05-11ASP checkbox复选框是否被选中的代码(结合数据库)
  • 2017-05-11asp木马代码解密的随机加密webshell
  • 2017-05-11asp fso操作类
  • 2017-05-11通过asp程序来创建access数据库
  • 2017-05-11asp 通用修改和增加函数代码
  • 2017-05-11ASP处理多关键词查询实例代码

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • ASP编程入门进阶(七):内置对象Server
    • ASP 操作cookies的方法
    • ASP基础入门第八篇(ASP内建对象Application和Session)
    • ASP生成随机数 ASP生成不重复随机数
    • sql语句的一些集合
    • 如何在ASP页面动态Inclue文件?
    • asp文本框换行显示代码
    • Access模糊查询查不到数据的解决方法
    • asp 数据库连接函数代码
    • ASP Recordset 分页显示数据的方法(修正版)

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有