亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我的代碼執行不了?

為什么我的代碼執行不了?

未來99 2016-11-09 21:25:53
這個是我跟著課程寫的 ?js**************************************************************************function getByClass(clsName,parent){? var oparent=parent?document.getElementById(parent):document;? ? ? eles=[],? ? ? elements=oparent.getElementsByTagName('*');? for(var i=0,l=elements.length;i<l;i++){? ? if(elements[i].clssName==clsName){? ? ? eles.push(elements[i]);? ? }? }? return eles;};? ? // ?切換列表var skip=document.getElementById('skip'),? ? skip_list=document.getElementById('skip_list'), lis=skip_list.getElementsByTagName('li'),? ? skip_txt=document.getElementById('skip_txt');? ? skip.onclick=function(){ skip_list.style.display='block'; }; ? ? // ?鼠標滑過、離開和點擊選擇列表時 for(var i=0,l=lis.length;i<l;i++){ lis[i].onmouseover=function(){ ? ? ? ? this.className='selected'; } lis[i].onmouseout=function(){ this.className=''; } ? ?lis[i].onclick=function(){ var id = this.id; skip_list.style.display='none'; skip_txt.innerHTML=getByClass('select_text',id)[0].innerHTML; } };我想做一個切換效果這個 ? HTML ? 結構*****************************************************************************************<div class="search_wrapper">? ? ? ? ? <form>? ? ? ? ? ? <div>?? ? ? ? ? ? ? ? <div class="skip" id="skip"><a href="#" id="skip_txt">商品</a></div>? ? ? ? ? ? ? ? <i class="icon_1"></i>? ? ? ? ? ? ? ? <ul id="skip_list" class="skip_list" style="display:none;">? ? ? ? ? ? ? ? <li id="curriculum"><a href="#" class="select_text">商品</a></li>? ? ? ? ? ? ? ? <li id="school"><a href="#" class="select_text">店鋪</a></li>? ? ? ? ? ? </div>?? ? ? ? ? ? <input type="text" id="search_input" class="search_input" placeholder="請輸入關鍵詞...">? ? ? ? ? <input type="submit" class="search" value="搜索">? ? ? ? ? </form>? ? ? ? ? </div>這個是 CSS ?樣式*****************************************************************************.search_wrapper { position:relative; float: right; height: 45px; width: 451px; line-height: 45px; margin-top: 13px; border: 2px solid #7FC7A0; background-color: #474645; background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(97,96,95,1.00) 20.73%,rgba(71,70,69,1.00) 100%); background-image: -moz-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(97,96,95,1.00) 20.73%,rgba(71,70,69,1.00) 100%); background-image: -o-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(97,96,95,1.00) 20.73%,rgba(71,70,69,1.00) 100%); background-image: linear-gradient(180deg,rgba(255,255,255,1.00) 0%,rgba(97,96,95,1.00) 20.73%,rgba(71,70,69,1.00) 100%);}.search_wrapper a {color:#E3E8E7; text-decoration:none;}.search { width: 40px; height: 30px; border: 1px solid #BDF4E4; border-radius: 4px; background-color: #90D3E3; background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,1.00) 15.03%,rgba(144,211,227,1.00) 70.47%); background-image: -moz-linear-gradient(270deg,rgba(255,255,255,1.00) 15.03%,rgba(144,211,227,1.00) 70.47%); background-image: -o-linear-gradient(270deg,rgba(255,255,255,1.00) 15.03%,rgba(144,211,227,1.00) 70.47%); background-image: linear-gradient(180deg,rgba(255,255,255,1.00) 15.03%,rgba(144,211,227,1.00) 70.47%); color: #283A35; font-family: "新宋體"; font-weight: bold; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; text-shadow: 0 1px 0 rgba(0, 0 ,0, .3); -moz-box-shadow: inset, 0 1px 0 #F3FAFB; -webkit-box-shadow:inset 2px 2px 0px #F3FAFB; box-shadow:inset 2px 2px 0px #F3FAFB;}.search :hover, search :focus { width: 40px; height: 30px; border-radius: 4px; background-color: #90D3E3; background-image: -webkit-linear-gradient(270deg,rgba(144,211,227,1.00) 20.21%,rgba(255,255,255,1.00) 88.60%); background-image: -moz-linear-gradient(270deg,rgba(144,211,227,1.00) 20.21%,rgba(255,255,255,1.00) 88.60%); background-image: -o-linear-gradient(270deg,rgba(144,211,227,1.00) 20.21%,rgba(255,255,255,1.00) 88.60%); background-image: linear-gradient(180deg,rgba(144,211,227,1.00) 20.21%,rgba(255,255,255,1.00) 88.60%); }.search :active { outline: 0; ? ?? ? ?-moz-box-shadow: inset 1px 4px 0px 0px #F3FAFB; -webkit-box-shadow: inset 1px 4px 0px 0px #F3FAFB; box-shadow: inset 1px 4px 0px 0px #F3FAFB; }.search ::-moz-focus-inner { border: 0; }.skip {width:56px;float:left; margin: 0 2px;}.skip_list {width: 56px; border: 2px solid #7FC7A0; position:absolute; left: -2px; top:-2px; background-color: #50887F; z-index: 2; display:block;}.search_input { height: 28px; width: 300px; border: solid #EDEDED 3px; font-size: 15px; font-weight: 600;}.selected {background-color: #474645; display:block;background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(97,96,95,1.00) 20.73%,rgba(71,70,69,1.00) 100%); background-image: -moz-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(97,96,95,1.00) 20.73%,rgba(71,70,69,1.00) 100%); background-image: -o-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(97,96,95,1.00) 20.73%,rgba(71,70,69,1.00) 100%); background-image: linear-gradient(180deg,rgba(255,255,255,1.00) 0%,rgba(97,96,95,1.00) 20.73%,rgba(71,70,69,1.00) 100%);}.icon_1 { width: 15px; height: 12px; float:left; margin: 16px 0; background: url(../images/i_1.jpg) left no-repeat;}
查看完整描述

1 回答

已采納
?
摩訶迦葉

TA貢獻146條經驗 獲得超54個贊


var oparent=parent?document.getElementById(parent):document,

? ? ? eles=[],

? ? ? elements=oparen.getElementsByTagName('*');

你用,結束語句?

查看完整回答
反對 回復 2016-11-09
  • 未來99
    未來99
    什么叫結束語句,是用;嗎?
  • 摩訶迦葉
    摩訶迦葉
    那肯定啊,基本代碼規則。。。。
  • 未來99
    未來99
    但改了還是不行啊 你幫我看一下,我復制了報錯
點擊展開后面10
  • 1 回答
  • 0 關注
  • 930 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號