写两个class,A,B;
在你想更改的事件中,更改<div>的class.

解决方案 »

  1.   

    onMouseOver="this.className='BBB'" onMouseOut="this.className='aaa'">
      

  2.   

    谢谢大家啊!hij333(我会改签名了.YEAH) ,syue(孤星)的想法可行,可是还是别扭啊。
    ssssssssssss能不能搞一个示范呢?您这么点到为止,我等还是云雾中人啊。哪位大师写段范例程序,最好是一个css类解决问题,实际元素只要 <div class="BBB">就可以了??
      

  3.   

    凡是类Class="BBB"的,默认style="A",onMouseOver 时style="B",onMouseOut时style恢复"A".程序怎么写才好呢?
    能不能设计一个类,指定默认style和替换style,并绑定事件?而不是生硬地这么写<div style="" onMouseOver="" onMouseOut=""> ?
    jquery   一句就OK了....$(".BBB").mouseover(function(){ $(this).addClass("A").removeClass("B");}).mouseout(function(){ $(this).addClass("B").removeClass("A"); });
      

  4.   

    demo:
      <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
    <style>
    .BBB {width:100px; height:100px; background:#f00; border:1px solid #00f;}
    .B { width:100px; height:100px; background:#f00;}
    .A { width:100px; height:100px; background:#00f;}
    </style>
    <div class="BBB B">
    </div>  <script type="text/javascript">
    $(document).ready(function(){
    $(".BBB").mouseover(function(){ $(this).addClass("A").removeClass("B");}).mouseout(function(){ $(this).addClass("B").removeClass("A"); });
    });
      </script>
      

  5.   

    用htc 应该可以实现不过这个好像只有IE支持
      

  6.   

    现在见过,不算太晚....官方:
    http://www.jquery.com中文站:
    http://jquery.org.cn
      

  7.   

    style="x"
    x 是标准CSS语法...你干吗非要乱搞别的进去....CSS可以用虚类解决...
    :visited
    :hover
    :link
    :active....
      

  8.   

    <style type="text/css">
    .BBB {width:100px; height:100px; background:#f00; border:1px solid #00f;}
    .B { width:100px; height:100px; background:#f00;}
    .A { width:100px; height:100px; background:#00f;}
    </style>
    <div id="wc" class="BBB B">&nbsp;</div>
    <script type="text/javascript">
    window.onload = function () {
    var re = new Function("a", "b", "this.className = this.className.replace(new RegExp(a + '$'), b)");
    with (document.getElementById("wc")) {
    onmouseover = function () { re.call(this, "B", "A") }, onmouseout = function () { re.call(this, "A", "B") };
    }
    }
    </script>