日期:2014-05-18  浏览次数:20393 次

求无刷新的分类切换代码
哪位大侠能给javascript实现的无刷新的分类切换的代码呀!鼠标移过去就能切换的那种
先谢谢了!

------解决方案--------------------
1 一个先全部读出来,隐藏,通过JS来控制显示

2 用框架

3 AJAX
------解决方案--------------------
<div id= "content_a " style= "display:none; position:absolute; ">
这是第一个DIV </div>
<div id= "content_b ">
这是第二个DIV </div>
<asp:Button ID= "Button1 " runat= "server " Text= "Button " onmouseover= "aaaa() " onmouseout= "bbbb() "/>
function aaaa()
{
document.getElementById( "content_a ").style.display= "inline ";
}
function bbbb()
{
document.getElementById( "content_a ").style.display= "none ";
}
------解决方案--------------------
回复人:honey52570(steven hu) ( 五级(中级)) 信誉:100 2007-09-14 17:35:13 得分:0

1 一个先全部读出来,隐藏,通过JS来控制显示

2 用框架

3 AJAX
------解决方案--------------------
AJAX-TAB导航效果
http://radio.fc510.com/code/tabnews.rar
------解决方案--------------------
1 一个先全部读出来,隐藏,通过JS来控制显示
<script>
function show(id)
{
document.getElementById( 'div1 ').style.display= 'none ';
document.getElementById( 'div2 ').style.display= 'none ';
document.getElementById( 'div '+id).style.display= ' ';
}
</script>
<span onmouseover= "show(1) "> class-1 </span> <span onmouseover= "show(2) "> class-2 </span>
<div id=div1> <%=string1%> </div> <div id=div2> <%=string2%> </div>

2 用框架
<script>
function show(id)
{
document.getElementById( 'frm ').src= 'page '+id+ ".aspx ";
}
</script>
<span onmouseover= "show(1) "> class-1 </span> <span onmouseover= "show(2) "> class-2 </span>
<iframe id=frm src= "page1.aspx "> </iframe>
3 AJAX
<script>
function show(id)
{
var oHttpReq, oDoc;

if(window.ActiveXObject)
oHttpReq = new ActiveXObject( "MSXML2.XMLHTTP ");
else
oHttpReq = new XMLHttpRequest();

oHttpReq.open( "GET ", "getdata.aspx?id= "+id, false);
oHttpReq.send(null);
var result = oHttpReq.responseText;
document.getElementById( "div1 ").innerHTML = result;

}
</script>
<span onmouseover= "show(1) "> class-1 </span> <span onmouseover= "show(2) "> class-2 </span>
<div id=div1> </div>

===可能有bug 紧供参考