jQuery对话框无法在IE 9.0上运行,但在Chrome上运行良好,需要在IE上运行 [英] JQuery dialog not working on IE 9.0, but good in Chrome, need to run in IE

查看:47
本文介绍了jQuery对话框无法在IE 9.0上运行,但在Chrome上运行良好,需要在IE上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个经典的ASP文件, default.asp创建一个对话框,并打开并加载default2.asp default2.asp显示了一些控件和一个链接,该链接调用一个执行一些活动并关闭对话框的javascript函数.

I have two classic asp files, default.asp which creates a dialog and opens with load default2.asp default2.asp shows some controls and a link which calls a javascript function which does some activity and close the dialog

这个东西在Chrome中可以正常工作,但在IE 9.0中却不能,任何人都知道为什么吗?将受到高度赞赏.

This thing is working fine in Chrome but not in IE 9.0, can any one have idea why? will be highly appreciated.

谢谢

<!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 ------- ---------------------------------

------------------------------------- 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>

推荐答案

我发现我正在使用Google api,该api在Chrome上运行良好,但在IE中无法正常运行,因此我将这些引用替换为从JQuery.com下载的JQuery文件,并进行了测试他们在IE上,对于在Question中提到的这个问题,一切正常.

I found that I was using Google apis which works fine on Chrome but not in IE so I replaces those references with JQuery files downloaded from JQuery.com and I tested them on IE and everything works fine for this problem mentioned in Question.

感谢大家的回答,并尽力帮助我:)

Thanks all for answering and tried to help me with their best :)

http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js http://ajax.googleapis.com/ajax/libs /jquery/1.9.1/jquery.min.js

这篇关于jQuery对话框无法在IE 9.0上运行,但在Chrome上运行良好,需要在IE上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆