Posts Tagged ‘javascript’

CreateObject(”MSXML2.DOMDocument”)

星期二, 10月 21, 2008 14:30 1 Comment

1. CreateObject(”MSXML2.DOMDocument”)
this is VB code to create a DOMDocument object using the MSXML2 library
2. new ActiveXObject(”MSXML.DOMDocument”)
this is javascript to create a DOMDocument object using the MSXML library
3. Server.CreateOject(”Microsoft.XMLDOM”)
this is ASP vbscript to create a version independent DOMDocument object
Note:
1. Only for built in objects, such as filesystemobject, dictionary etc. Any object which comes from an external [...]

This was posted under category: 技术 Tags: , , ,

How to put javascript in a page using masterpage?

星期一, 05月 12, 2008 15:23 No Comments

Question:
How to put javascript in a page using masterpage? Error message: Validation (XHTML 1.0 Transitional): Content is not supported outside ’script’ or ‘asp:content’ regions.
Answer:
Place the script inside the <asp:content> tag. Because you are using content area and a master page, the
id will be prefixed with the master and content area names. you should use ClientId [...]

This was posted under category: 工作 Tags: , , ,

使用脚本调用系统的关机对话框

星期五, 01月 18, 2008 16:25 No Comments

以前有介绍如何使用命令行调用系统的关机对话框: http://blog.csdn.net/scz123/archive/2005/09/30/492991.aspx
具体方法:开始/运行:rundll32.exe shell32.dll #60
但是,上述方法会存在一问题,XP下无法正常使用该方法进行关机(感谢网友沐烨 发现该问题)。问题原因可能是:正常情况下,关机对话框是有explorer.exe调用,直接使用rundll32调用时无法触发相关命令。
既然使用explorer.exe调用可以,我们可以尝试使用脚本来实现。实现原理:
1. 激活explorer.exe
2. 按ALT+F4
编写VBS脚本如下(将下述内容另存为shutdown.vbs):
Dim objWMI,wsh
Dim colProcesses,objProcess
pid=0
set objWMI = GetObject( “winmgmts:{impersonationLevel=impersonate}\\. \root\cimv2″ )
set colProcesses = objWMI.ExecQuery( “SELECT * FROM Win32_Process” & _
” WHERE Name=’explorer.exe’” )
for Each objProcess In colProcesses
pid = objProcess.ProcessId
Next
set wsh = WScript.CreateObject(”WScript.Shell”)
wsh.AppActivate pid
wsh.sendKeys “%{F4}”
上述脚本运行环境为:XP SP2
其他环境也可能正常工作,不过对于有多个explorer.exe进程的系统,就可能不正常工作了,如开了远程终端服务的多用户环境下。
来源: http://blog.csdn.net/scz123/archive/2008/01/14/2043143.aspx

This was posted under category: 工作, 技术 Tags: ,

JavaScript 组件之 JQuery(A~Z) 教程 (基于Asp.net运行环境)

星期四, 01月 17, 2008 18:22 No Comments

目录
(一).概述
(二).预备条件
(三).代码示例
2.Dom对象和jQuery对象转换示例
3.访问对象内部元素
4.显示/隐藏元素
5.根据条件查询对象元素集合
6.Document.Ready方法示例
7.Html方法示例
8.元素事件注册以及实现示例
9.Filter和no方法使用示例
10.一个很有用的方法:Css方法使用示例
11.滑动显示/隐藏元素
12.操作父元素
13.Toggle方法使用示例
14.Animate方法使用示例
15.改变表格行为(bycalssproperty)
16.操作jQuery属性示例
17.利用Wrap方法动态的修改控件外观
18.动态切换Css样式
19.Prepend-Wrap-Append组合方法示例
20.操作集合示例
21.扩展jQuery系统方法
22.触发元素事件示例
23.为元素绑定和移除事件
24.each方法用法
25.检查浏览器能力
26.解决$符被jQuery占用问题,prototype类库也有$方法
(一).概述
现在有好多比较优秀的客户端脚本语言组件, 如: Prototype、YUI、jQuery、mootools、Bindows, Scriptaculous, FCKEditor 等, 都非常不错, 最近研究了一下 jQuery,在学习时顺便整理了一个教程, 后面会有示例代码下载链接.
jQuery是JavaScript语言的一个新的资源库(框架) ,它能快速,简洁的使用HTML documents, handle events, perform animations,并且能把Ajax交互应用到网页,jQuery能够改变你书写JavaScript的方式.
(二).预备条件
本文章中所有示例都是基于Asp.net 2.0运行环境.
不需要安装操作, 只需要把jQuery脚本文本引入页面, 即可使用jQuery这个强大组件的功能, 如下:
1 <script src=Resources\js\jquery-1.2.1.js type=”text/javascript”></script>
(三).代码示例
1. 访问页面元素
1 <head runat=”server”>
2     <title>访问元素</title>
3     <script src=Resources\js\jquery-1.2.1.js type=”text/javascript”></script>
4         <!–将jQuery引用进来–>
5         <script type=”text/javascript”>
6         function GetElement()
7         {
8             //<summary>通过ID获取元素TextBox1的客户端Dom对象</summary>
9             tb = $(”#<%= TextBox1.ClientID %>”)[0];       //1. 通过索引获取Dom对象
10             tb = $(”#<%= TextBox1.ClientID %>”).eq(0)[0]; //2. 通过eq, eq(0)获取的是JQuery对象, 再通过索引获取Dom对象.
11             tb = [...]

This was posted under category: 工作, 技术 Tags: ,

奥运倒计时

星期一, 10月 1, 2007 15:50 No Comments

   var timedate= new Date(”August 8,2008″);
   var times= “中国北京 奥运会”;
   var now = new Date();
   var date = timedate.getTime() - now.getTime();
   var time = Math.floor(date / (1000 * 60 * 60 * 24));
   if (time >= 0)
      document.write(”现在距离 “+times+” 还有: “+time +” 天.”)

源码如下:
<script type=”text/javascript”>
   var timedate= new Date(”August 8,2008″);
   var times= “中国北京 奥运会”;
   [...]

This was posted under category: 技术 Tags: ,