这个在firefox浏览器就可以显示,但在其它浏览就不好用,是不是其它浏览器不$('#notice').toggle?
<td><img src="../images/rightMenu_04.png" width="80" height="38" alt="" onclick="$('#notice').toggle();showinfo();" /></td>
///
<div id="notice" style="z-index: 10"><center><font color='red' size='5'>公告栏</font></center><br><span id='showinfo'></span></div>
<td><img src="../images/rightMenu_04.png" width="80" height="38" alt="" onclick="$('#notice').toggle();showinfo();" /></td>
///
<div id="notice" style="z-index: 10"><center><font color='red' size='5'>公告栏</font></center><br><span id='showinfo'></span></div>
$(this).toggle();
showinfo(); //此处的函数应该是LZ自己创建的吧。
});
$(this).toggle();
showinfo(); //此处的函数应该是LZ自己创建的吧。
});
你这么写不对了,我的firefox都不好用了!
<script type="text/javascript">
$("#img1").click(function(){
$("#notice").toggle();
showinfo(); //此处的函数应该是LZ自己创建的吧。
});</script>
写法本身就不标准. jQuery(function($)
{
$("#imgxxx").click(function(){
$('#notice').toggle();
showinfo();
});//imgxxx
});
<script>
$('img#im').click(function(){
$('#notice').toggle();showinfo();
});
</script>
<td> <img src="../images/rightMenu_04.png" width="80" height="38" alt="" id="im" /> </td>
///
<div id="notice" style="z-index: 10"> <center> <font color='red' size='5'>公告栏 </font> </center> <br> <span id='showinfo'> </span> </div>
我在用一个小例子在其它浏览器上就可以实现的!下面的DIV就可以点击隐藏与出现的!
<script type='text/javascript' src='./jquery-1.3.2.min.js'></script>
</HEAD><script type='text/javascript'>
function chat_say(){
var msg=document.getElementById('msg').value;
msg = encodeURI(msg);
var xmlHttp=window.ActiveXObject ? new ActiveXObject("Microsoft.xmlHTTP"):new XMLHttpRequest();
xmlHttp.onreadystatechange=function(){return chat_doHttpReadyStateChange.call(xmlHttp, xmlHttp)};
xmlHttp.open("GET","/MytestProj/chat.php?&say="+msg,true);
xmlHttp.send(null);
}
function chat_doHttpReadyStateChange(xmlHttp){
if(xmlHttp.readyState==4 && xmlHttp.status == 200 ){
var msg=document.getElementById("showmsg");
var showmsg=xmlHttp.responseText;
msg.innerHTML=showmsg;
}
}
</script> <BODY><center>
<h1>ChatRoom</h1><br/>
<div id='showmsg'></div><br/>
<input type='text' id='msg'></input><input type='button' value='发送' onclick='chat_say()'></input> </center>
<div id='text' style="backcolor:red">mytext</div>
<br><input type="button" value='text' onclick="javascript:$('#text').toggle();">
</BODY>
</HTML>