解决方案 »
- js函数返回值问题
- jquery中多个下拉框如何获取已选值(每个下拉框的name相同)
- 【分享】JavaScript播放MP3歌词同步显示
- javascript searchFiles问题
- 在ff下,onmousedown和ondblclick同时使用,ondblclick无效??
- 想这样的一段文字,用javascript怎么输出来?
- 好象在IE7下面用'加入收藏'代码不行了.给为进来看吧
- 怎么使用数组的sort()方法进行排序???
- 怎样通过链接实现表单提交?
- 计算某一时间(2002-08-01)5天后的日期的值(2002-08-01格式) 在线给分
- js 正则表达式 验证问题
- 怎么让日期控件每隔两天可选啊
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("p").click(function(){
$("#demoTable").append("<input type='button' id='btn1' value='按扭' onclick='test(this)' />");
});
});
function test(e) {
alert($(e).attr('id'));
$(e).hide();
}
</script>
</head>
<body>
<table id="demoTable">
</table>
<p>如果您点击我,我会消失。</p>
<p>点击我,我会消失。</p>
<p>也要点击我哦。</p>
</body>
</html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type='text/javascript'>
$(function(){
for(var i=0;i<5;i++){
$('#demoTable').append("<tr><td><input name='' type='button' value='test'/></td></tr>");
}
$('#demoTable input').live('click',function(){
alert(123);
});
})
</script><table id="demoTable">
</table>
我刚才换了firefox,发现可以实现了,可是ie就没有反应,有什么办法让ie也有效果呢?谢谢
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("p").click(function(){
$("#demoTable").append("<tr><td><input type='button' id='btn1' value='按扭' onclick='test(this)' /></td></tr>");
});
});
function test(e) {
alert($(e).attr('id'));
$(e).hide();
}
</script>
</head>
<body>
<table id="demoTable">
</table>
<p>如果您点击我,我会消失。</p>
<p>点击我,我会消失。</p>
<p>也要点击我哦。</p>
</body>
</html>
恩,我改过来了,可是现在还是在firefox下可以实现了,ie就没有反应,有什么办法让ie也有效果呢?谢谢
});
});这样既可以给每行绑上事件,有可以根据每行的ID进行不同的处理