第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

container.onmouseover=play跟container.onmouseover=play()有什么區(qū)別?

<!doctype?html>
<html>
<head>
<meta?charset="utf-8">
<title>焦點(diǎn)輪播圖-練習(xí)</title>
<style>
*{?margin:0;?padding:0;?text-decoration:none;}
body{?padding:20px;}
#container{?position:relative;?width:600px;?height:400px;?overflow:hidden;?border:3px?solid?#000;}
#list{?position:absolute;?width:4200px;?height:400px;?z-index:1;}
#list?img{?float:left;}
#buttons{?position:absolute;?z-index:2;?bottom:20px;?left:250px;?height:10px;?width:100px;}
#buttons?span{?cursor:pointer;?float:left;?border:1px?solid?#FFF;?background:#333;?width:10px;?height:10px;?border-radius:50%;?margin-right:5px;}
#buttons?.on{?background:orangered;}
.arrow{?color:#FFF;?background-color:RGBA(0,0,0,.3);?cursor:pointer;?display:none;?line-height:39px;?font-size:36px;?text-align:center;?width:40px;?height:40px;?font-weight:bold;?position:absolute;?z-index:2;?top:180px;}
.arrow:hover{?background:RGBA(0,0,0,.7);}
#container:hover?.arrow{?display:block;}
#prev{?left:20px;}
#next{?right:20px;}
</style>
????<script>
????????window.onload?=?function?()?{
????????????var?container?=?document.getElementById('container');
????????????var?list?=?document.getElementById('list');
????????????var?buttons?=?document.getElementById('buttons').getElementsByTagName('span');
????????????var?prev?=?document.getElementById('prev');
????????????var?next?=?document.getElementById('next');
????????????var?index?=?1;
????????????var?animated?=?false;
????????????var?timer;
????????????//亮燈函數(shù)
????????????function?showButton()?{
????????????????for?(var?i?=?0;?i?<?buttons.length;?i++){
????????????????????if?(buttons[i].className?==?'on'){
????????????????????????buttons[i].className?=?'';
????????????????????????break;
????????????????????}
????????????????}
????????????????buttons[index?-?1].className?=?'on';
????????????}
????????????//輪播函數(shù)
????????????function?animate(offset)?{
????????????????animated?=?true;
????????????????var?newLeft?=?parseInt(list.style.left)?+?offset;
????????????????var?time?=?300;//位移總時(shí)間
????????????????var?interval?=?10;//位移間隔時(shí)間
????????????????var?speed?=?offset/(time/interval);//每次位移量
????????????????//輪播過渡函數(shù)
????????????????function?go()?{
????????????????????if?((speed?<?0?&&?parseInt(list.style.left)?>?newLeft)?||?(speed?>?0?&&?parseInt(list.style.left)?<?newLeft)){
????????????????????????list.style.left?=?parseInt(list.style.left)?+?speed?+?'px';
????????????????????????setTimeout(go,interval);
????????????????????}
????????????????????else{
????????????????????????animated?=?false;
????????????????????????list.style.left?=?newLeft?+?'px'
????????????????????????if?(newLeft?>?-600){
????????????????????????????list.style.left?=?-3000?+?'px';
????????????????????????}
????????????????????????if?(newLeft?<?-3000){
????????????????????????????list.style.left?=?-600?+?'px';
????????????????????}
????????????????}
????????????????}
????????????????go();
????????????}

????????????function?play()?{
????????????????timer?=?setInterval(function?()?{
????????????????????next.onclick();
????????????????},1500);
????????????}
????????????function?stop()?{
????????????????clearInterval(timer);
????????????}

????????????next.onclick?=?function?()?{
????????????????if?(!animated){
????????????????????if?(index?==?5){
????????????????????????index?=?1;
????????????????????}
????????????????????else?{
????????????????????????index?+=?1;
????????????????????}
????????????????????showButton();
????????????????????animate(-600);
????????????????}
????????????}
????????????prev.onclick?=?function?()?{
????????????????if?(!animated){
????????????????????if?(index?==?1){
????????????????????????index?=?5;
????????????????????}
????????????????????else?{
????????????????????????index?-=?1
????????????????????}
????????????????????showButton();
????????????????????animate(600);
????????????????}
????????????}
????????????
????????????for?(var?i?=?0;?i?<?buttons.length;?i++){
????????????????buttons[i].onclick?=?function?()?{
????????????????????if?(this.className?==?'on'){
????????????????????????return;
????????????????????}
????????????????????var?myIndex?=?parseInt(this.getAttribute('index'));
????????????????????var?offset?=?-600?*?(myIndex?-?index);
????????????????????index?=?myIndex;
????????????????????showButton();
????????????????????if?(!animated){
????????????????????????animate(offset);
????????????????????}
????????????????}
????????????}
????????????container.onmouseover?=?stop();
????????????container.onmouseout?=?play();

????????}
????</script>
</head>

<body>
<div?id="container">
???<div?id="list"?style="left:-600px;">
???????<img?src="img/5.jpg"?alt="1">
????????<img?src="img/1.jpg"?alt="1">
????????<img?src="img/2.jpg"?alt="2">
????????<img?src="img/3.jpg"?alt="3">
????????<img?src="img/4.jpg"?alt="4">
????????<img?src="img/5.jpg"?alt="5">
????????<img?src="img/1.jpg"?alt="5">
????</div>
????<div?id="buttons">
???????<span?index="1"?class="on"></span>
????????<span?index="2"></span>
????????<span?index="3"></span>
????????<span?index="4"></span>
????????<span?index="5"></span>
????</div>
????<a?href="javascript:;"?id="prev"?class="arrow">&lt;</a>
????<a?href="javascript:;"?id="next"?class="arrow">&gt;</a>
</div>
</body>
</html>

以上是源碼;以下的簡(jiǎn)略截圖。

5836f93b0001b6f904470121.jpg

5836f93b00011ea702950072.jpg

這兩個(gè)截圖的代碼有什么區(qū)別?

第一張圖的代碼,onmouseover跟onmouseout函數(shù)都可以執(zhí)行(onmouseout函數(shù)是圖片自動(dòng)輪播,onmouseover是鼠標(biāo)放上去之后停止輪播。);

第二張圖的代碼,圖片可以自動(dòng)輪播,但是鼠標(biāo)放上去之后,圖片沒有停止輪播。

play()跟play有什么區(qū)別?

麻煩各位慕同學(xué)指點(diǎn)迷津!

謝謝!!

回答的都是帥哥 | 美女!^_^

正在回答

3 回答

加括號(hào)返回值是執(zhí)行函數(shù)后的返回值,不加括號(hào)返回的是整個(gè)函數(shù)信息

0 回復(fù) 有任何疑惑可以回復(fù)我~

如果你寫stop(); ?表示的是立即執(zhí)行,不管你前面的條件有沒有被觸發(fā)。

但是如果寫成 function () { stop();}, 就表示,你前面的條件執(zhí)行了, 就開始執(zhí)行函數(shù), 函數(shù)就是里面的stop();

只用stop, 類似指針,指向的是stop();這個(gè)函數(shù),?

記住一條:如果你把函數(shù)名寫全了, 就變成了立即執(zhí)行,如果你是條件式的, 前面都要加function(){你要加的函數(shù)}, 或者只寫一個(gè)函數(shù)名, 后面不要括號(hào)(前提是, 你的函數(shù)里面沒有參數(shù))

你可以寫一個(gè)alert實(shí)驗(yàn)一下


4 回復(fù) 有任何疑惑可以回復(fù)我~
#1

小白菜v

受教了,謝謝
2017-07-04 回復(fù) 有任何疑惑可以回復(fù)我~

沒區(qū)別,只是少寫和多寫。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

CIPHER 提問者

功能不一樣。
2016-12-02 回復(fù) 有任何疑惑可以回復(fù)我~
#2

咩咩咩3124927 回復(fù) CIPHER 提問者

你好,你提問的這個(gè)問題搞清楚了嗎?我也是這點(diǎn)有點(diǎn)疑惑
2016-12-06 回復(fù) 有任何疑惑可以回復(fù)我~
#3

rainy_li3676598

自己不懂,就不要誤導(dǎo)別人
2016-12-06 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

container.onmouseover=play跟container.onmouseover=play()有什么區(qū)別?

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)