0
我寫了這個簡單的功能:的setInterval和功能
HTML:
<div class="mhead">
<div class="mTop">
<a class="headline" title="" href="">
<img alt="" src="">
<span> </span>
</a>
</div>
<div class="tNav">
<ul id="topt" class="tUl">
<li title="http://www.site.com/761028497.jpg"> <a title="" href="">1</a> </li>
<li title="http://www.site.com/761028497.jpg"> <a title="" href="">2</a> </li>
</ul>
</div>
功能:
$.fn.inters = function (target) {
this.find('li').hover(function() {
var head = $(this).find('a').attr('title');
var image = $(this).attr('title');
var href = $(this).find('a').attr('href');
$(target).find('img').attr('src', image);
$(target).find('img').attr('alt', head);
$(target).attr('href', href);
$(target).attr('title', head);
$(target).find('span').html(head);
}).eq(0).hover();}
$("#topt").inters('.headline');
我想補充setInterval
這個腳本:
$(function() {
setInterval("inters()", 3000);
});
但標題不變。每3000毫秒如何在inters
函數中進行更改?
在此先感謝
@kevin,我已經測試你的方式和@ stecb的方式,但它不工作。我的功能有問題,但我無法找到它。 – utopia 2011-04-23 19:44:23
@utopia:你能發佈受影響的HTML嗎? – Kevin 2011-04-23 19:47:03
@kevin,我編輯了我的問題。謝謝。 – utopia 2011-04-23 20:09:53