<html>
<head>
<title>Javascript</title>
<script language="Javascript" type="text/javascript">
function callMethod()
{
/*http://localhost/waa/WebService.asmx为Service的URL,然后加上?wsdl,calService为定义的一个名称,类似声明一个变量*/
service.useService("http://localhost/waa/WebService.asmx?wsdl","calService");
var parm1 = Form1.all.mul1.value; //获取第一个参数 (此Service只有一个参数)
service.calService ......
因为JSON 是 javascript 的一个子集,所以,在javascript 中使用JSON是非常简单的。
js 代码
var myJSONObject = {"bindings": [
{"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
{"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
{"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}
]
};
在上面的例子中,我们创建了只包含一个成员 "bindings" 的一个对象,bindings 则包含了一个由3个对象组成的数组。这3个对象都包含3个成员:"ircEvent", "method","regex"。
在javascript 中, 成员可以通过“点号”来获取。
比如:
JSON 解析器。 一个 JSON 解析器将只接受 JSON ......
var myDate = new Date();
myDate.getYear(); //获取当前年份(2位)
myDate.getFullYear(); //获取完整的年份(4位,1970-????)
myDate.getMonth(); //获取当前月份(0-11,0代表1月)
myDate.getDate(); //获取当前日(1-31)
myDate.getDay(); //获取当前星期X(0-6,0代表星期天)
myDate.getTime(); //获取当前时间(从1970.1.1开始的毫秒数)
myDate.getHours(); //获取当前小时数(0-23)
myDate.getMinutes(); //获取当前分钟数(0-59)
myDate.getSeconds(); //获取当前秒数(0-59)
myDate.getMilliseconds(); //获取当前毫秒数(0-999)
myDate.toLocaleDateString(); //获取当前日期
var mytime=myDate.toLocaleTimeString(); //获取当前时间
myDate.toLocaleString( ......
//后台CS调用前台JS方法
ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script>CheckInput()</script>");
//校验输入框是否为空,校验是否是数字
<script type="text/javascript" language="javascript">
function CheckInput() {
if (document.form1.txt_ReceiptID.value == "") {
alert('报销单号不能为空!');
document.form1.txt_ReceiptID.focus();
return false;
}
else {
  ......
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
自动刷新页面的方法:
1.页面自动刷新:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20">
其中20指每隔20秒刷新一次页面.
2.页面自动跳转:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20;url=http://www.wyxg.com">
其中20指隔20秒后跳转到http://www.wyxg.com/
页面
3.页面自动刷新js版
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
ASP.NET如何输出 ......
AA.HTM
-------------------------------------
<!--
showModalDialog函数的使用 (转)
本范例可以实现弹出一个模态窗口,并演示了两种接收和传递参数的方法,同时可以接受模态窗口返回的多个变量
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>主界面</title>
</head>
<body>
<form id="getForm"> 回传值:
<input type="text" id="getData" readOnly>
<input type="text" id="getData1" readOnly>
<input type="text" id="getData2" readOnly>
</ ......