我创建了两个jquery和脚本标记来日历确认..but,当它们在单独的html页面中时,它工作,当两个脚本在相同的page..Why中时,它不工作,对吗?
<script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.21.custom.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$('#click').click(function(){
//$(function() {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
resizable: false,
height:140,
modal: true,
buttons: {
"Ok": function() {
$('#form1').submit();
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
});
});
</script>
<script type="text/javascript" src="jquery/jquery.min.js"></script>
<script type="text/javascript" src="jsdatepick-calendar/jquery.1.4.2.js"></script>
<script type="text/javascript" src="jsdatepick-calendar/jsDatePick.jquery.min.1.3.js"></script>
<script type="text/javascript" src="jquery/fadeslideshow.js"></script>发布于 2012-07-16 17:25:48
看一看jQueries没有冲突。http://api.jquery.com/jQuery.noConflict/
这使得您可以使用来自不同jQuery版本/库的某些函数。
发布于 2012-07-16 17:28:01
尝试重新排序您的脚本,这可能会导致问题。你多次使用jQuery,这很可能是你问题的原因。
此外,您应该尝试格式化您的代码,使它更清楚地发生了什么。例如,我将脚本的type标记放在开头,以便于阅读。
你是否特别在你的对话框中放置了不带引号的Cancel?我已经在下面更正了这一点。
<script type="text/javascript" src="Scripts/jquery-1.7.2.min.js" ></script>
<script type="text/javascript" src="Scripts/jquery-ui-1.8.21.custom.min.js"></script>
<!--jQuery again here?--><script type="text/javascript" src="jsdatepick-calendar/jsDatePick.jquery.min.1.3.js"></script>
<script type="text/javascript" src="jquery/fadeslideshow.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#click').click(function(){
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
resizable: false,
height: 140,
modal: true,
buttons: {
"Ok": function() {
$('#form1').submit();
},
"Cancel": function() {
$( this ).dialog( "close" );
}
}
})
})
});
</script>发布于 2012-07-16 17:55:33
( function($$$) {
$$$(document).ready(function(e) {
//Code here
});
} ) ( jQuery ); https://stackoverflow.com/questions/11501412
复制相似问题