为什麼这段javascript在FF中没效果?

来源:百度知道 编辑:UC知道 时间:2024/06/19 16:25:09
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>未命名页面</title>
</head>

<body>

<input id="txt" type="text" name="txt" size="10" onblur="check1(txt.value)" style="border-top:0px solid #eee;border-left:0px #eee solid;border-right:0px #eee solid;border-bottom:1px #333 solid;" >  
<label style="color:#ff0000;font-size:14px; background:#aaa" id="ltext">请输入!</label>
<br /><br />
<input id="tel" type="text&qu

失去焦点这里直接传id,如 onblur=‘check1("txt")’
然后JS根据id获得值
function check1(st_id){ //输入的参数改下

var st = document.getElementById(st_id).value; //加行这个

这样FF就可以用了