开发者

Mouseover script not working... Need help

Can someone try this and see if it works for you. I can't figure out the problem.. Maybe I have a conflict somewhere. Using jquery.

Thank you so much for the help.

  <script type="text/javascript">
  $(document).ready(function(){
  $('a').mouseover(function() {
  switch ($(this).attr('class')) {
  case 'nc1':
    new_content = 'Twitter';
    break;

  case 'nc2':
    new_content = 'Facebook';
    break;

  case 'nc3':
    new_content = 'Linked In';
    break;

  case 'nc4':
    new_content = 'Flickr';
    break;
  case 'nc5':
    new_content = 'RSS Feed';
    break;

  case 'cs1':
    new_content = 'Email';
    break;
  case 'cs2':
    new_content = 'Telephone';
    break;

  case 'cs3':
    new_conte开发者_运维问答nt = 'Live Chat';
    break;

  case 'cs4':
    new_content = 'Skype';
    break;

  case 'cs5':
    new_content = 'Google Voice';
    break;

  default:
    new_content = 'The crusade to feed every orphan in the world';
    break;
  }

  $('#ms').html(new_content)
  }).mouseout(function() {
  $('#ms').text('The crusade to feed every orphan in the world');
  });});
  </script>




  <div id="ms">The crusade to feed every orphan in the world.</div>

  <div id="nc_wrap2">
  <a class="nc1" href="#"></a>
  <a class="nc2" href="#"></a>
  <a class="nc3" href="#"></a>
  <a class="nc4" href="#"></a>
  <a class="nc5" href="#"></a>
  </div>


Works just fine if you put some content in your links ...

example at http://www.jsfiddle.net/x4Lm4/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜