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

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

麻煩幫看下哪里出了問(wèn)題,謝謝

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8"/>

<title>Image Gallery</title>

<link rel="stylesheet" type="text/css" href="css/index.css">

</head>

<body>

<h1>Snapshots</h1>

<div class="image-box">

<ul id="imageGallery">

<li><a href="images/3.jpg" title="鞋子">鞋子</a></li>

<li><a href="images/5.jpg" title="行李箱">行李箱</a></li>

<li><a href="images/7.jpg" title="手機(jī)">手機(jī)</a></li>

<li><a href="images/11.jpg" title="體恤衫">體恤衫</a></li>

</ul>

<!-- <img id="placeholder" src="images/course5.jpg" alt="my Image Gallery"/> -->


</div>

<!-- <p id="description">Choose an image.</p> -->


? <script type="text/javascript" src="js/index.js"></script>

</body>

</html>

// 以下代碼那里錯(cuò)誤?

function addLoadEvent(func){

var oldload=window.onload;

if(typeof window.onload!="function"){

window.onload=func;

}else{

window.onload=function(){

oldload();

func();

}

}

}

function preparePlaceholder(){

if(!document.createElement) return false;

if(!document.createTextNode) return false;

if(!document.getElementById) return false;

if(!document.getElementById("image-box")) return false;

var placeholder=document.createElement("img");

placeholder.setAttribute("id","placeholder");

placeholder.setAttribute("src","images/course5.jpg");

placeholder.setAttribute("alt","my Image Gallery");

var imageBox=document.getElementById("image-box");

imageBox.appendChild(placeholder);

var description=document.createElement("p");

description.setAttribute("id","description");

var txt=document.createElement("Choose an image.");

description.appendChild(txt);

document.body.appendChild(description);

}

function prepareGallery(){

if(!document.getElementById) return false;

if(!document.getElementsByTagName) return false;

if(!document.getElementById("imageGallery")) return false;

var imageGallery=document.getElementById("imageGallery");

var aLinks=imageGallery.getElementsByTagName("a");

for(var i=0;i<aLinks.length;i++){

aLinks[i].onclick=function(){

//showPic(this);

// console.log(this);

return showPic(this) ? false:true;

}

//aLinks[i].onkeypress=aLinks[i].onClick;

}?


}

//addLoad? ?Event(prepareGallery);

function showPic(whichpic){

if(!document.getElementById("placeholder")) return false;

var source=whichpic.getAttribute("href");

var placeholder=document.getElementById("placeholder");

placeholder.setAttribute("src",source);

if(document.getElementById("description")){

var text=whichpic.getAttribute("title")? whichpic.getAttribute("title"):"",

description=document.getElementById("description");

if(description.firstChild.nodeType==3){

description.firstChild.nodeValue=text;

}

}

return true;//如果description存在,它將會(huì)被更新,否則會(huì)忽略。

// window.onload=countBodyChild();//每點(diǎn)擊一次,彈出一次;

//countBodyChild();//每點(diǎn)擊一次,彈出一次;

}

addLoadEvent(preparePlaceholder);

addLoadEvent(prepareGallery);



body{

? ?padding:30px 0 0 100px;

}

ul,li{

list-style-type: none;;

}

li{

display:inline-block;

margin-right:50px;

}

a{

text-decoration:none;

color:#900;

font-weight: bold;

font-size:16px;

}

p{

font-size:20px;

font-weight:bold;

}

我想實(shí)現(xiàn)的是點(diǎn)擊li中的文字后,動(dòng)態(tài)的創(chuàng)建出placeholder對(duì)象和description對(duì)象,并將li中a連接的圖片顯示到place holder中,將a鏈接的title屬性中的文字顯示到description中,麻煩幫我看看為什么,我一點(diǎn)擊a鏈接就跳轉(zhuǎn)到新的頁(yè)面打開(kāi)圖片了。

正在回答

舉報(bào)

0/150
提交
取消

麻煩幫看下哪里出了問(wèn)題,謝謝

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

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

幫助反饋 APP下載

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

公眾號(hào)

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