var test=true;alert(typeof(test));//返回类型啦
var test='true';alert(typeof(test));//String
isNaN(number)//判断是否为数字
ul.myList > li > a{
text-decoration:none
color:#336600;
}
<ul class="myList">
<li><a ></a>//选定 第一个li 和li下面第一个a
<ul>
<li><a>
var oli=document.getElementByTagName("tagname");
alert(oli.length oli[1].childNodes[0].nodeValue)
注册事件//IE
window.οnlοad=function(){
op=document.getElementById("myP");
op.attachEvent("onclick",fnclick);
}
function fnclick(){
op.detachevent("onclick",fnclick);
}
//其他
op.addEventListener("click",fnclick1,false)//false 冒泡事件 true 捕获事件
op.removeEventListener()//删除事件
function fnclick1(){}
处理兼容
op.οnclick=function(event)
{
if(window.evnet)event=window.event;
}
调试javascript代码的好方法! try catch
try{
alert();
alert(asdf);
}
cathc(exception){
var error="";
for (var i in exception)
error+= i+":"+exception[i]+"\n";
alert(error);
}
利用js跳出框架<a href="#" οnclick="window.top.location='/YHTWeb/wantxyInfo.do?method=getWantxyYytj&hospitalID=${d.hospitalid }'">
<bean:write property="hospitalname" name="d"/>
</a>