<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>select-option onclick </title>
<script type="text/javascript" >
function simOptionClick4IE(){
var evt=window.event ;
var selectObj=evt?evt.srcElement:null;
// IE Only
if (evt && selectObj && evt.offsetY && evt.button!=2
&& (evt.offsetY > selectObj.offsetHeight || evt.offsetY<0 ) ) {
// 记录原先的选中项
var oldIdx = ......
1.javascriptでURLの"?"以降のパラメータを取得:
var query = window.location.search.substring(1);
var pairs = query.split("&");
2.IE浏览器默认的功能停止
(Tab键在地址栏等中的移动停止)
function stopDefaultKey(){
window.event.cancelBubble = true; //--- イベントバブルをキャンセルする。
window.event.returnValue = false; //--- イベントのreturn値をfalseにする。
return false ;
}
3.javascript 静态变量,同一个js文件中声明一次,多处可用
this.变量名
4.javascript的keyCode
event.keyCode == 13 ⇒Enter
event.keyCode == 9 ⇒Tab ......
在IE中调试客户端JavaScript脚本标签: 脚本 调试 WEB 2.0 JavaScript 使用Atlas Debug Helper Class
1.debug.assert(condition, message, displayCaller) 断言condition 是否为true。如果condition为false,该方法将显示出message的内容。如果displayCaller为true,该方法将显示出调用者的信息。
清除trace的输出。
以可读的形式在页面尾部显示object对象的内部状态。name值用来显示该对 象的名称。如果recursive为true,将递归显示该对象内部的所有被包含的对象的信息。indentationPadding值用来指定输出的每一行的起始文本
Break到调试器中。(仅应用于Internet Explorer中)
将text参数输出到trace当中。演示如何使用debug.dump()请见参考文档将Visual Studio 脚本调试器attach到Internet Explorer您可以使用Visual Studio脚本调试器来调试您的JavaScript代码。虽然这个调试器功能有限且有许多bug,不过我觉得它已经是此刻市面上最好的JavaScript调试器了。您需要安装V ......
一般:object.constructor == String ;(String 或者Number 等等 )
特殊:判断一个数组Array
方法1:
Object
.prototype.toString.apply(value) ===
'[object Array]'
方法2:
用jQuery,其实和方法1同。
$.isArray(object);
......
当页面加载以后,执行JavaScript,按秒开始计数:
JavaScript function:
<SCRIPT language="JavaScript">
<!--Timer in JavaScript
var timerform
speed=1000
function dotimer()
{
today=new Date()
slutsec=today.getSeconds()
slutmin=today.getMinutes()
sluttim=today.getHours()
sluta=(slutsec) + 60 * (slutmin) + 3600 * (sluttim)
diff=sluta - starta
tim=Math.floor(diff / 3600)
min=Math.floor((diff / 3600 - tim) * 60)
sek=Math.round((((diff / 3600 - tim) * 60) - min) * 60)
document.timerform.timer.value=tim + ':'
if(min<10)document.timerform.timer.value+='0'
document.timerform.timer.value+=min + ':'
if(sek<10)document.timerform.timer.value+='0'
document.timerform.timer.value+=sek
window.setTimeout("dotimer()",speed)
}
function Timer()
{
today=new Date()
startsek=today.getSeconds()
startmin=today.getMinutes()
starttim=today.getHours()
starta=(startsek) + 60 * (startmin) + 3600 * (starttim)
document.write('<form name=timerform><input name=timer siz ......
@author songfeng
因为JS内对象的方法实际上是存储语句的一个类似于指针的东西. 其指向了内存的一个位置, 也就是其函数的位置,当然也可以让其指向一个变量值.
var foo = new Object();
foo.bar = function() {} //现在foo.bar就是指向了这个函数的内存位置.
foo.bar = "abcdefg"; //现在其指向了内存中的字符串
也就是说它们的名子是一样的, 第二个会把第一个覆盖掉, 并不会有任何提示.
下面是我今天遇到的问题.
<form action="" name="applyForm" namemethod="post">
<input type="text" name="foo" value="" />
&nbs ......