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

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

關(guān)于JS的問題

關(guān)于JS的問題

Will_木 2017-06-01 15:59:02
<%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE html><html>? ? <head>? ? ? ? <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">? ? ? ? <title>Picture Album</title>? ? ? ? <style>? ? ? ? ? ? #wrap{? ? ? ? ? ? ? ? width: 50%;? ? ? ? ? ? ? ? margin: 0 auto;? ? ? ? ? ? }? ? ? ? ? ? #presentation{? ? ? ? ? ? ? ? float:left;? ? ? ? ? ? ? ? font-size: 20px;? ? ? ? ? ? }? ? ? ? ? ? #showing{? ? ? ? ? ? ? ? float:right; ? ? ? ? ??? ? ? ? ? ? }? ? ? ? </style>? ? ? ? <script type="text/javascript">? ? ? ? ? ? function change(obj) {? ? ? ? ? ? ? ? var source = obj.getAttribute("href");? ? ? ? ? ? ? ? var placeholder = document.getElementById("showing");? ? ? ? ? ? ? ? placeholder.setAttribute("src", source);? ? ? ? ? ? }? ? ? ? </script>? ? </head>? ? <body>? ? ? ? <h1 style="text-align:center;">Picture Album</h1>? ? ? ? <div id="wrap">? ? ? ? ? ? <div id="presentation">? ? ? ? ? ? ? ? <ul>? ? ? ? ? ? ? ? ? ? <li><a href="photo/blue.jpg" onclick="change(this);return false;">Blue</a></li>? ? ? ? ? ? ? ? ? ? <li> <a href="photo/fire.jpg" onclick="change(this);return false;">Fire</a></li>? ? ? ? ? ? ? ? ? ? <li><a href="photo/sex.jpg" onclick="change(this);return false;">Sex</a></li>? ? ? ? ? ? ? ? </ul>? ? ? ? ? ? </div>? ? ? ? ? ? <div ?id="showing">? ? ? ? ? ? ? ? <img width="300" height="200" src="photo/world.jpg"/>? ? ? ? ? ? </div>? ? ? ? </div>? ? </body></html>想問一下 ?為什么點擊鏈接后,該頁面放置圖片的地方的圖片沒有改變???
查看完整描述

1 回答

已采納
?
Caballarii

TA貢獻(xiàn)1123條經(jīng)驗 獲得超629個贊

var placeholder = document.getElementById("showing");拿到的是img的父元素div,所以把id放到img上就對了。

<div>
????????????????<img?id="showing"?width="300"?height="200"?src="photo/world.jpg"/>
????????????</div>


查看完整回答
反對 回復(fù) 2017-06-01
  • Will_木
    Will_木
    soga!!!謝謝
  • Will_木
    Will_木
    <script type="text/javascript"> function change(obj) { var source = obj.getAttribute("href"); var placeholder = document.getElementById("pic"); placeholder.setAttribute("src", source); } function num() { var body_element = document.getElementById("body")[0]; alert(body_element.childNodes.length); } window.onload = num; </script> 請問一下 為什么頁面加載后沒有彈出提示框
  • Caballarii
    Caballarii
    body不是id。直接var body_element = document.body;就行了
點擊展開后面1
  • 1 回答
  • 0 關(guān)注
  • 1399 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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