<!doctype html><html><head>?? ?<meta charset="UTF-8">?? ?<title>Document</title></head><body>?? ?<ul>?? ??? ???????????????????????? <li>?? ??? ??? ?<a href="1.jpg" onclick="showPic(this)" title="A fireworks display">第一張圖片</a>?? ??? ??? ?</li>?? ??? ?<li>?? ??? ??? ?<a href="2.jpg" title="A cup of black coffee">第二張圖片</a>?? ??? ??????????? </li>?? ??? ?<li>?? ??? ??? ?<a href="3.jpg">第三張圖片</a>?? ??? ??? ?</li>?? ??? ?<img id="img1" src="4.jpg">????????????????????? ??? ?</ul>?? ??? ?<script type="text/javascript">?? ?window.onload=function()?? ?????????? { function showPic(whichpic)?? ????????? ??? ??????????? {?? ????????? ??? ?????????? ??? ?var source=whichpic.getAttribute('href')?? ????????? ??? ?????????? ??? ?var placeholder=document.getElementById('img1')?? ????????? ??? ?????????? ??? ?placeholder.setAttribute("src",source)?? ????????? ??? ??????????? }?? ?????????? }?? ?</script>?? ?</body></html>
求幫忙看下這段代碼,為什么沒有效果
慕粉4084340
2016-10-21 17:26:24