我有两个经典的asp文件, default.asp,它创建一个对话框并使用load default2.asp打开 default2.asp显示了一些控件和一个调用javascript函数的链接,该函数执行一些活动并关闭对话框
这个东西在Chrome中运行良好但在IE 9.0中没有,任何人都知道为什么?将受到高度赞赏。
由于
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Default.asp</title>
<link rel="stylesheet" href="/jquery/themes/base/jquery-ui.css" />
<script src="/JQuery/jquery-1.9.1.js"></script>
<script src="/JQuery/jquery-ui.js"></script>
<style>
body { font-size: 85.5%; }
div#mydiv { width: 350px; margin: 20px 0; }
</style>
<script>
$(document).ready(function(){
var MyDlg = $( "#mydiv" );
MyDlg.dialog({
autoOpen: false,
closeOnEscape: true,
modal: true,
width: 300,
height: 400,
modal: true,
resizable: true,
buttons: {
Cancel: function() {
MyDlg.dialog( "close" );
}
}
});
$("#Opendlg").click(function() {
MyDlg.load("Default2.asp").dialog("open");
});
});
</script>
</head>
<body>
This is a test form-1
<br><br>
<%
Dim FName, LName
FName = Request.form("fname")
LName = Request.form("lname")
Response.write("The First name was := " & FName & " and Last name was:=" & LName )
%>
<br><br>
<form ID=Form1 method="post" action="Default.asp">
First Name: <input type="text" name="fname"><br>
Last Name: <input type="text" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
<br><br>
<input type="button" class="ui-widget" ID="Opendlg" value="Open Dialog"/>
<div id="mydiv" title="Product Wizard">
</div>
</body>
</html>
------------------------------------- Default2.asp ------- ---------------------------------
<script type="text/javascript">
$(function() {
$('#Form2').submit(function(evt) {
evt.preventDefault();
$.ajax({
url: "Default2.asp",
type: 'POST',
data: $(this).serialize(),
success: function(result) {
$('#mydiv').html(result);
}
});
});
});
var MyDlg = $( "#mydiv" );
$(".ui-widget-overlay").click (function () {
MyDlg.dialog( "close" );
});
function CloseMe()
{
$("#mydiv").dialog("close");
}
</script>
This is Default2.asp file
<br><br>
<%
Dim Name, Address
Name = Request.form("Name")
Address = Request.form("address")
Response.write("The Name was " & Name & " and Address was " & Address )
%>
<a href="Javascript:CloseMe();">Close Me</a>
<br><br>
<form ID=Form2 >
Name: <input type="text" name="Name"><br>
Address: <input type="text" name="address"><br><br>
<input type="submit" value="Submit">
</form>
答案 0 :(得分:0)
$(this).closest('.ui-dialog-content').dialog('close');
尝试是..它将关闭对话框。
答案 1 :(得分:0)
我发现我使用的是Google apis,它在Chrome上工作正常,但在IE中却没有。所以我用从JQuery.com下载的JQuery文件替换这些引用,我在IE上测试它们,一切正常,问题中提到的这个问题。
感谢所有人的回答,并试图尽力帮助我:)
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js