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

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

新手問題,求解

新手問題,求解

azureks 2016-05-05 19:47:10
1:testmodel,第71行,動態添加模塊,我這樣的寫法太麻煩了,如果模塊很大的話,求簡潔方式2:testmodel部分,第130行 div id=login模塊 我想讓其在頂層自動居中在界面最中央,但是就是居中不了。求正確方式3:testcode部分,我用的單例,但是js寫法很納悶,不知道是不是寫的正確4:假設有兩個js文檔名字為A.js,B.js,A如何訪問B內的東西?(不在HTML里把兩個都給引入了,僅引入其中一個A)testmode:<!DOCTYPE?html> <html> <head> <meta?charset="UTF-8"> <title></title> <style> body{ margin:?10px?auto; width:?90%; height:?auto; background-color:?#A9A9A9; } img{ width:?150px; height:?100px; } #cont{ background-color:?#A9A9A9; text-align:?center; overflow:?hidden; float:?left; margin:?3px; position:?relative; } #div1{ border:?1px?solid?#FF0000; float:?left; background-color:?#FAEBD7; } #text{ width:?70px; position:?absolute; background-color:?#FFA500; transform:?rotate(-45deg)?translate(-20px,-10px); -webkit-transform:?rotate(-45deg)?translate(-20px,-10px); font-size:?13px; padding:?3px?3px; } #zhezhao{ background-color:?#0000CC; width:?100%; height:?100%; position:?absolute; opacity:?0; } #zhezhao:hover{ opacity:0.5; } #login{ background-color:?#F0F8FF; position:?absolute; padding:?20px?20px; margin-left:?auto; margin-right:?auto; } #closs{ width:?20px; height:?20px; text-align:?center; background-color:?green; top:?0px; right:?0px; } </style> <script> window.onload=function(){ var?txtdiv=document.getElementById("text"); txtdiv.stopPropagation; var?ap=document.getElementById("append"); for?(var?i=0;i<6;i++)?{ //這么添加模塊,如果模塊很大,就寫法很麻煩,求簡潔方式 var?alldiv=document.createElement("div"); alldiv.setAttribute("id","cont"); ap.appendChild(alldiv); var?div1=document.createElement("div"); div1.setAttribute("id","div1"); alldiv.appendChild(div1);? var?imgs=document.createElement("img"); imgs.setAttribute("src","assets/5vip.jpg"); imgs.setAttribute("width","150px"); imgs.setAttribute("heigth","100px"); div1.appendChild(imgs); var?div2=document.createElement("div"); div2.innerHTML="第二VIP"; div1.appendChild(div2);? var?zz=document.createElement("div"); zz.setAttribute("id","zhezhao"); alldiv.appendChild(zz); } //建立點擊監聽,但是這里卻有故障,直接執行了。。。 document.getElementById("closs").addEventListener("click",logins(0)); // document.getElementById("denglu").addEventListener("click",logins(1)); } function?logins(num){ console.log(num); if(num==0)document.getElementById("login").style.opacity=0; if(num==1)document.getElementById("login").style.opacity=1;? } </script> </head>? <body> <div><button?id="denglu">登陸</button></div> <div?id="append"> <div?id="cont"> <div?id="div1"> <img?src="assets/5vip.jpg"?/> <div>第一VIP</div> </div> <div?id="zhezhao"></div> <div?id="text">示例1</div> </div> <div?id="cont"> <div?id="div1"> <img?src="assets/5vip.jpg"??/> <div>第一VIP</div> </div> <div?id="zhezhao"></div> </div> </div> <div?id="login"> <div?id="closs">X</div> 帳號:<input?type="text"?/> </br></br> 密碼:<input?type="password"?/> </br></br> <button>提交測試</button> </div> </body> </html> --------------------------------------------------------------------------------------------- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\testcode部分:<!DOCTYPE?html> <html> <head> <meta?charset="UTF-8"> <title></title> <script?src="jquery-1.12.2.min.js"></script> </head> <body> <script> var?result={ calliden:function(arg){ var?_xw=iden(arg); console.log(_xw) return?_xw; }? } //document.write(result.calliden(["612324198205250038","555"])); document.write(result.calliden("999")); function?iden?(arg){ var?msg; var?arrmsg; if(arg.constructor==Array){ if(!arrmsg){ arrmsg=new?Array; } arrmsg=[]; for?(var?i=0;i<arg.length;i++)?{ // arrmsg.push(new?IdentityCodeValid(arg[i])) } return?arrmsg; } if(arg.constructor==String){ if(!msg){ msg=new?IdentityCodeValid(arg) } return?msg; } msg=null; arrmsg=[]; } function?IdentityCodeValid(code)?{????? ????return?1231231; } </script> </body> </html>
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1526 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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