我下定决心要搞明白这个功能,关于jquery的,希望大家帮帮我,谢谢

不好意思,我是搞设计的,初学jquery

我想做obama的首页那种会自动播放的slide banner,

http://www.barackobama.com/index.php

于是,我就把它代码取了出来,无耻的用在了自己的网站上

http://www.talkcorporate.com/



现在,我想吧,老是抄人家代码,咱也得搞明白人家代码是怎么写的是吧?不能老是拷贝吧,这就和我们国家制造业一样,要掌握核心技术,对吧。



现在我研究了下,但是,有个地方老看不明白



// Switches to the next story (returns to first story once the last story has been reached)

function auto_change()

{

var next_story = _current_story + 1 < _news_links.length ? _current_story + 1 : 0;

change_story(next_story);

}






他这个就是什么意思啊?

好长一串啊!!!!我是javascript初学者,请大家用比较通俗的语言解释下好吗?谢谢!

楼主是不清楚"?:"的用法吧.
[code="js"]var next_story = _current_story + 1 < _news_links.length ? _current_story + 1 : 0; [/code]
等价于:[code="js"]
var next_story;
if(_current_story+1<_news_links.length){
next_story=_current_story+1;
}else{
next_story=0;
}[/code]

"?:"是一个三元运算符(expr1?expr2:expr3)

即:执行表达式expr1,它的值会返回true或者false.如果为true,则这整个?:块的值就为表达式expr2的值,如果expr1的值为false,则值为expr3.

"?:"不是javascript专有的,几乎所有的语言都有这个操作符.楼主平时看书不够细心啊. :wink: