Navi

2010年8月2日 #

引用外部JS文件的两种方法比较

引用外部JS文件的两种方法:
第一种:<!--#include file="../JS/MyCalendar.js"-->
第二种:<script src="../admin/mum.js" type="text/javascript"> </script>

两种方法比较:
<!--#include>语句 在服务器的执行优先级别高,既可以说:服务器解释asp文件时,第一步先把所有<!--#include>文件先执行了,插入到当前页,然后再从头开始解释整个asp网页。
<script language='text/javascript'不在服务器执行,而是在用户浏览器上执行,也就是说,前面在执行asp页面的时候,并不包含<script>里面的<!--#include>。

注:
第二种方法<script src="../admin/mum.js" type="text/javascript"> </script>不要写成
<script src="../admin/mum.js" type="text/javascript" />否则,会让你很郁闷。

posted @ 2010-08-20 11:27 Navi 阅读(851) | 评论 (0)编辑 收藏

应用程序捕获未处理异常的方法

项目中提示未处理异常,无法捕获。提示信息如下:
“Application has generated an exception that could not be handled”
解决方法如下:
 1public static void Main()   
 2  
 3     AppDomain currentDomain =   AppDomain.CurrentDomain; 
 4     currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptions); 
 5           
 6  }
 
 7
 8private static void UnhandledExceptions(object sender, UnhandledExceptionEventArgs args) 
 9  
10     Exception e = (Exception)   args.ExceptionObject; 
11     //try to trace the stack here and see   what,when and why. 
12  }
这就可以在 UnhandledExceptions方法中捕获到未处理的异常,并做相应的处理。
注:
AppDomain: 一个应用程序在其中执行的独立环境。

posted @ 2010-08-20 09:07 Navi 阅读(216) | 评论 (0)编辑 收藏

.NET 文件的扩展名

VS文件扩展名的全拼,自己解释的不知道是否正确。
aspx = Active Server Page eXtension                        页面文件
asax = Active Server Application eXtension              Gloab文件
ascx = Active Server Control eXtension                    用户控件文件
asmx = Active Server Method eXtension                   webService文件
ashx = Active Server Handler eXtension

posted @ 2010-08-02 14:15 Navi 阅读(297) | 评论 (0)编辑 收藏

页面对搜索引擎的相关设置

参加一次面试。其中的一道题是:如何设置页面不被搜索引擎搜索到?
没有回答上来,网上查了一下。
<meta name="Robots" contect= "all|none|index|noindex|follow|nofollow">
其中的属性说明如下:
设定为all:文件将被检索,且页面上的链接可以被查询;
设定为none:文件将不被检索,且页面上的链接不可以被查询;
设定为index:文件将被检索;
设定为follow:页面上的链接可以被查询;
设定为noindex:文件将不被检索,但页面上的链接可以被查询;
设定为nofollow:文件将不被检索,页面上的链接可以被查询。

posted @ 2010-08-02 13:44 Navi 阅读(123) | 评论 (0)编辑 收藏