急急,在线等 <input name="sch" type="text" id="sch" class="find" value="搜索" onfocus="sch()" onblur="schlose()" />当我在body里面加上form后就出错,对象不支持此属性或方法。去掉form后就没有问题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 sch,schlose这两个方法怎么写的? function sch() { document.form1("sch").value=""; } function schlose() { if(document.getElementById("sch").value == "") { document.getElementById("sch").value = "搜索"; } } function sch() { document.getElementById("sch").value=""; } <!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><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><link rel="stylesheet" type="text/css" href="Ehome.css"><style type="text/css"><!--.STYLE4 {color: #838383}.STYLE5 {color: #3A494B}--></style></head><script type="text/javascript"> function sch() { document.getElementById("sch").value = ""; } function schlose() { if(document.getElementById("sch").value == "") { document.getElementById("sch").value = "搜索"; } } function menu(id) { for(i=1;i<8;i++) { if(i == id) { document.getElementById("tbl"+i).style.display = 'block'; document.getElementById("td"+i).innerHTML="<img src='WEB/tag.gif'/>" } else { document.getElementById("tbl"+i).style.display = 'none'; document.getElementById("td"+i).innerHTML=""; } } } function pattern() { for(i=1;i<8;i++) { document.getElementById("tbl"+i).style.display = 'none'; } } </script><body topMargin=0 onload="pattern()"><form><table width="986" height="38" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="400"><span class="STYLE4">品质生活 - 爱家无限</span></td> <td> </td> <td align="right"><table width="200" height="20" border="0" cellpadding="0" cellspacing="0" style="margin-top:8px"> <tr> <td width="65" align="left"><a href="javascript:window.external.AddFavorite('http://www.mstarroom.com','智能家居')">加入收藏</a></td> <td width="65" align="left"><a onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.mstarroom.com');return" href="http://www.mstarroom.com/" false;="false;">设为首页</a></td> <td width="20" align="left" valign="top"><img src="WEB/home.gif" width="16" height="15"/></td> <td width="50" align="right"><a href="#">控制后台</a></td> </tr> </table> <A href="javascript:window.external.AddFavorite('http://www.mstarroom.com','智能家居')"></A> <A onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.mstarroom.com');return" href="http://www.mstarroom.com/" false;="false;"></A><a href="#"> </a></td> </tr></table><table width="980" height="53" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:20px"> <tr> <td width="25"><img src="WEB/navigation_1.gif" width="25" height="53" /></td> <td width="116" background="WEB/navigation_2.gif" class="logo"> </td> <td width="648" background="WEB/navigation_2.gif"><table width="648" height="30" border="0" cellpadding="0" cellspacing="0" class="head" style="margin-top:20px"> <tr> <td width="44" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(1)"> </td> <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(1)">关于爱得屋</td> <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(2)">新闻中心</td> <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(3)">产品系列</td> <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(4)">解决方案</td> <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(5)">项目展示</td> <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(6)">销售网络</td> <td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(7)">客服服务</td> <td width="44" height="18" align="center" valign="top"> </td> </tr> <tr> <td width="44" align="center"></td> <td align="center" id="td1"></td> <td align="center" id="td2"></td> <td align="center" id="td3"></td> <td align="center" id="td4"></td> <td align="center" id="td5"></td> <td align="center" id="td6"></td> <td align="center" id="td7"></td> <td width="44" align="center"> </td> </tr> </table> </td> <td width="22"><img src="WEB/navigation_3.gif" width="22" height="53" /></td> <td width="143" background="WEB/navigation_4.gif"><table width="113" height="20" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="30" valign="bottom"><input id="sch" name="sch" class="find" value="搜索" onfocus="sch()" onblur="schlose()"/></td> </tr> <tr> <td height="10"> </td> </tr> </table></td> <td width="25"><img src="WEB/navigation_5.gif" width="25" height="53" /></td> </tr></table></form></body></html> document.getElementById("tbl"+i).style.display = 'none';是不是这句的问题?? 你那个id为sch的input 没得type啊 和这个没关系,你测试搜索框,加form和不加form。 document.getElementById("tbl"+i).style.display = 'none';有错,缺少对象 <input id="sch" name="sch" class="find" value="搜索" onfocus="sch()" onblur="schlose()"/> 有错,type='text' 属性少了 下面的内容没贴出来,太长了,原因不在这里,你可以删掉function menu(id)和pattern(),然后只看搜索框 不是这的原因,加上type='text'和没加一样 function sch1() { document.getElementById("sch").value = ""; }<input id="sch" name="sch" class="find" value="搜索" onfocus="sch1()" onblur="schlose()"/> 求正则表达式 关于替换问题 jquery语法错误 js 脚本错误的问题求解啊 这些双引号怎么理解啊? 请教:增加一个插入按钮,当选中DIV后单击插入按钮就相当于执行于该div的双击事件,以取代双击事件; 下拉框取值问题,急急 QQ邮箱里有个明信片功能是怎么实现的? 有哪位高手能帮小弟解决下问题(用C#和js) 如何 判断TEXT内的值是否为数字? 关于nodejs在express框架下返回的response 单击浏览器的刷新按钮为什么不触发window.location.reload呢? 会Ext的进,在这框架之上在做一个小框架,可实现拖动、收缩。请大虾指点。万分感谢! 能否实现?
{
document.form1("sch").value="";
}
function schlose()
{
if(document.getElementById("sch").value == "")
{
document.getElementById("sch").value = "搜索";
}
}
{
document.getElementById("sch").value="";
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link rel="stylesheet" type="text/css" href="Ehome.css">
<style type="text/css">
<!--
.STYLE4 {color: #838383}
.STYLE5 {color: #3A494B}
-->
</style>
</head>
<script type="text/javascript">
function sch()
{
document.getElementById("sch").value = "";
}
function schlose()
{
if(document.getElementById("sch").value == "")
{
document.getElementById("sch").value = "搜索";
}
}
function menu(id)
{
for(i=1;i<8;i++)
{
if(i == id)
{
document.getElementById("tbl"+i).style.display = 'block';
document.getElementById("td"+i).innerHTML="<img src='WEB/tag.gif'/>"
}
else
{
document.getElementById("tbl"+i).style.display = 'none';
document.getElementById("td"+i).innerHTML="";
}
}
}
function pattern()
{
for(i=1;i<8;i++)
{
document.getElementById("tbl"+i).style.display = 'none';
}
}
</script>
<body topMargin=0 onload="pattern()">
<form>
<table width="986" height="38" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="400"><span class="STYLE4">品质生活 - 爱家无限</span></td>
<td> </td>
<td align="right"><table width="200" height="20" border="0" cellpadding="0" cellspacing="0" style="margin-top:8px">
<tr>
<td width="65" align="left"><a href="javascript:window.external.AddFavorite('http://www.mstarroom.com','智能家居')">加入收藏</a></td>
<td width="65" align="left"><a onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.mstarroom.com');return"
href="http://www.mstarroom.com/" false;="false;">设为首页</a></td>
<td width="20" align="left" valign="top"><img src="WEB/home.gif" width="16" height="15"/></td>
<td width="50" align="right"><a href="#">控制后台</a></td>
</tr>
</table> <A href="javascript:window.external.AddFavorite('http://www.mstarroom.com','智能家居')"></A> <A onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.mstarroom.com');return"
href="http://www.mstarroom.com/" false;="false;"></A><a href="#"> </a></td>
</tr>
</table>
<table width="980" height="53" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:20px">
<tr>
<td width="25"><img src="WEB/navigation_1.gif" width="25" height="53" /></td>
<td width="116" background="WEB/navigation_2.gif" class="logo"> </td>
<td width="648" background="WEB/navigation_2.gif"><table width="648" height="30" border="0" cellpadding="0" cellspacing="0" class="head" style="margin-top:20px">
<tr>
<td width="44" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(1)"> </td>
<td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(1)">关于爱得屋</td>
<td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(2)">新闻中心</td>
<td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(3)">产品系列</td>
<td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(4)">解决方案</td>
<td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(5)">项目展示</td>
<td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(6)">销售网络</td>
<td width="80" height="18" align="center" valign="top" style="cursor:hand" onmousemove="menu(7)">客服服务</td>
<td width="44" height="18" align="center" valign="top"> </td>
</tr>
<tr>
<td width="44" align="center"></td>
<td align="center" id="td1"></td>
<td align="center" id="td2"></td>
<td align="center" id="td3"></td>
<td align="center" id="td4"></td>
<td align="center" id="td5"></td>
<td align="center" id="td6"></td>
<td align="center" id="td7"></td>
<td width="44" align="center"> </td>
</tr>
</table>
</td>
<td width="22"><img src="WEB/navigation_3.gif" width="22" height="53" /></td>
<td width="143" background="WEB/navigation_4.gif"><table width="113" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="112" height="30" valign="bottom"><input id="sch" name="sch" class="find" value="搜索" onfocus="sch()" onblur="schlose()"/></td>
</tr>
<tr>
<td height="10"> </td>
</tr>
</table></td>
<td width="25"><img src="WEB/navigation_5.gif" width="25" height="53" /></td>
</tr>
</table>
</form>
</body>
</html>
是不是这句的问题??
有错,缺少对象
和pattern(),然后只看搜索框
function sch1()
{
document.getElementById("sch").value = "";
}<input id="sch" name="sch" class="find" value="搜索" onfocus="sch1()" onblur="schlose()"/>