課程
/前端開發(fā)
/jQuery
/jQuery基礎(chǔ)(三)—事件篇
把代碼貼到dw里運(yùn)行,網(wǎng)頁(yè)上沒效果,是哪的問題
2017-06-07
源自:jQuery基礎(chǔ)(三)—事件篇 7-1
正在回答
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JQ-test</title>
<style>
div { width: 500px; height: 200px; border: 1px solid green; margin: 0 auto; }
</style>
</head>
<body>
<div id="test">
<label></label><input type="text">
<input type="button" value="button1">
<input type="button" value="button2">
</div>
<!-- JS -->
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
<script type="text/javascript">
$('#test input:eq(1)').on('click',function(event,title){
if(!title){title = 'button1'}
updata(title)
})
$('#test input:eq(2)').click(function(){
$('#test input:eq(1)').trigger('click','button2')
function updata(title){
$('#test label:first').text(title);
var $text = $('#test input:first');
if(!$text.val()){ $text.val(0) }
$text.val(parseInt($text.val())+1)
}
</script>
</body>
</html>
用我寫的。
qq_細(xì)雨聽荷_0 提問者
舉報(bào)
jQuery第三階段開啟事件修煉,掌握對(duì)頁(yè)面進(jìn)行交互的操作
4 回答這節(jié)課為什么里面的代碼沒反應(yīng).......
4 回答keypress和keydown運(yùn)行起來效果一樣
4 回答這樣為啥沒效果?
1 回答這個(gè)有錯(cuò)嗎,為什么我輸出沒效果
3 回答寫的東西是按照答案給的,為什么沒效果?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-06-07
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JQ-test</title>
<style>
div { width: 500px; height: 200px; border: 1px solid green; margin: 0 auto; }
</style>
</head>
<body>
<div id="test">
<label></label><input type="text">
<input type="button" value="button1">
<input type="button" value="button2">
</div>
<!-- JS -->
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
<script type="text/javascript">
$('#test input:eq(1)').on('click',function(event,title){
if(!title){title = 'button1'}
updata(title)
})
$('#test input:eq(2)').click(function(){
$('#test input:eq(1)').trigger('click','button2')
})
function updata(title){
$('#test label:first').text(title);
var $text = $('#test input:first');
if(!$text.val()){ $text.val(0) }
$text.val(parseInt($text.val())+1)
}
</script>
</body>
</html>
用我寫的。