使用jquery:
1.jsp<body>
<%-- <jsp:include page="2.jsp" /> --%>
<script type="text/javascript">
var index = 0;
function addTab(){
index++;
$('#viewdata').tabs('add',{
title:'New Tab ' + index,
iconCls:'icon-save',
closable:true,
href:"2.jsp"
});
} $(function(){
$("#ok").bind("click", function(){
addTab();
});
});
</script>
</body>
.......
</html>
2.jsp
<head>
<script type="text/javascript">
function hello(){
alert('a');
$("#cancel").bind("click", function(){
alert('bbb');
});
}
$(function(){
hello();
});
</script>
</head>
<body>
<div>
<a href="#" id="cancel" class="easyui-linkbutton" iconCls="icon-ok">ok</a>
</div>
</body>
</html>
发现2.jsp中事件不响应,请问为什么????
1.jsp<body>
<%-- <jsp:include page="2.jsp" /> --%>
<script type="text/javascript">
var index = 0;
function addTab(){
index++;
$('#viewdata').tabs('add',{
title:'New Tab ' + index,
iconCls:'icon-save',
closable:true,
href:"2.jsp"
});
} $(function(){
$("#ok").bind("click", function(){
addTab();
});
});
</script>
</body>
.......
</html>
2.jsp
<head>
<script type="text/javascript">
function hello(){
alert('a');
$("#cancel").bind("click", function(){
alert('bbb');
});
}
$(function(){
hello();
});
</script>
</head>
<body>
<div>
<a href="#" id="cancel" class="easyui-linkbutton" iconCls="icon-ok">ok</a>
</div>
</body>
</html>
发现2.jsp中事件不响应,请问为什么????
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货