Navi

2010年8月20日 #

引用外部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 阅读(850) | 评论 (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 阅读(215) | 评论 (0)编辑 收藏

2010年8月2日 #

.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 阅读(296) | 评论 (0)编辑 收藏

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

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

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

2010年3月20日 #

JavaScript代码 设置默认打印机!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <script type="text/javascript">
  function init()
   {
 try
 {
  var nt = new ActiveXObject("WScript.Network");//alert(2);
  var oPrinters = nt.EnumPrinterConnections();//需要编写 ActiveX 控件来获得
  if(oPrinters==null||oPrinters.length==0)
  {
   alert('当前你的机器暂没安装打印机');
   return;
  }else
  {
   //alert('当前打印机台数:'+oPrinters.length);
  }
  var thisPrinter;
  
  for(i = 0; i<oPrinters.length; i+=2)
  {
   alert(oPrinters.Item(i+1));
   var name = oPrinters.Item(i+1);
   //name += "";
   if(name == "Microsoft XPS Document Writer")
   {
    nt.SetDefaultPrinter('Microsoft XPS Document Writer');
   }
  }
 }catch(e)
 {
  alert(e.name + ":" + e.message);
 }
   }
  </script>
 </HEAD>

 <BODY>
  <table width="100%">
 <tr> 
  <td align="center">
   <input id="Print" type="Button" value="Print" onclick="init();" style="width:60px;"/>
  <td>
 </tr>
  </table>
 </BODY>
</HTML>

posted @ 2010-03-20 12:09 Navi 阅读(1482) | 评论 (0)编辑 收藏

2010年3月1日 #

C# NT登录验证

/// <summary>
/// 验证NT帐号
/// </summary>
/// <param name="userName">用户名</param>
/// <param name="userPW">密码</param>
/// <returns></returns>       
private bool checkNT(string userName,string userPW)
{
    bool checkOk = false;
    try
    {
         DirectoryEntry dicObj = new DirectoryEntry("WinNT://bqc.corp.com", userName, userPW, AuthenticationTypes.Secure);
         Object native = dicObj.NativeObject;
         checkOk = true;
     }
     catch
     {
          checkOk = false;
      }

       return checkOk;
}

其中的DirectoryEntry()方法要引用System.DirectoryServices程序集。四个参数:1.用户所在域2.用户名3.密码4.权限类型

posted @ 2010-03-01 21:39 Navi 阅读(435) | 评论 (0)编辑 收藏

2009年8月24日 #

发布jsp项目

 

1.JSP中连接数据库应该把数据库的驱动程序,放在Tomcatlib目录下。

2.把项目拷贝到

3.启动Tomcat

4.打开浏览器输入:http://localhost:8080/JSP_Demo/index.htmlok!!

posted @ 2009-08-24 20:45 Navi 阅读(213) | 评论 (0)编辑 收藏

仅列出标题