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

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么用按鈕調(diào)用函數(shù)的方法沒有反應(yīng)?

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

? ? <title>SetTimeout</title>

? ? <script src="http://code.jquery.com/jquery-1.11.3.js"></script> ? ? ? ??

? ? <script type="text/javascript">

? ? ? ? $(document).ready(function fun() {

? ? ? ? ? ? //var $div = $('div'); //jQuery對象

? ? ? ? ? ? //var div = $div.get(0);

? ? ? ? ? ? //div.style.color = 'red'; //操作dom對象的屬性

? ? ? ? ? ? var div = document.getElementsByTagName('div');

? ? ? ? ? ? var $div = $(div);

? ? ? ? ? ? var $first = $div.first();

? ? ? ? ? ? $first.css = ('color', 'blue');

? ? ? ? });

? ? </script>

</head>


<body >

<div id ="id">javascript

? ? <p>javascript</p><div id="di">jQuery</div><h5>PHP</h5></div>

? ? <input value="button" type="button" onclick="fun()" />

? ? <div>元素一</div>

<div>元素二</div>

<div>元素三</div>


</body>


正在回答

3 回答

css?是一個函數(shù),它需要參數(shù)

0 回復(fù) 有任何疑惑可以回復(fù)我~

謝謝你??!我發(fā)現(xiàn)問題就出在$first.css = ('color', 'blue')這里,這里不能用等號。好像和src沒有太大關(guān)系,我也不太懂兩個src有什么區(qū)別。。

0 回復(fù) 有任何疑惑可以回復(fù)我~

你把<script src="http://code.jquery.com/jquery-1.11.3.js"></script>?

的src改成http://idcbgp.cn/static/lib/jquery/1.9.1/jquery.js

再把?$first.css = ('color', 'blue');

改成?$first.css('color', 'blue');

就可以了

而且$(document).ready(function(){})的作用是在頁面加載完以后就運行函數(shù),不需要再加一個onclick來運行函數(shù)

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

慕勒300643 提問者

謝謝你??!我發(fā)現(xiàn)問題就出在$first.css = ('color', 'blue')這里,這里不能用等號。好像和src沒有太大關(guān)系,我也不太懂兩個src有什么區(qū)別。。
2018-11-19 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

為什么用按鈕調(diào)用函數(shù)的方法沒有反應(yīng)?

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

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

幫助反饋 APP下載

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

公眾號

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