2011-11-12 75 views
-1

當我單擊加載按鈕時,使用水印插件的我的preview.php文件無法在IE 9中正確加載。它適用於其他瀏覽器。我通常與Jquery有這些瀏覽器兼容性問題。我該如何處理它們。 我有一個posthttp2.php文件Ajax Jquery .load函數在Internet Explorer 9中不起作用

<html> 
    <body> 
    <form method="post" enctype="multipart/form-data" action="preview3.php"> 

    <input id="button" type="button" value="load"/> 
    </form> 
    <div id="feedback"> </div> 
    <script type="text/javascript" src="js/jquery.js" > </script> 
    <script type="text/javascript" src="js/ajax3.js" > </script> 

    </body> 
    <html> 

    And the Ajax file is ajax3.js 

    $(document).ready(function(){ 
    $('#button').click(function() { 

    $('#feedback').load("preview3.php"); 
    }); 

    )}; 



    I have a preview.php file 

    <!DOCTYPE html> 
    <html> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>JQuery Image Watermark</title> 
    <link type="text/css" href="css/proj.css" rel="stylesheet" /> 

    <script type="text/javascript" src="js/jquery.js"></script> 
      <script type="text/javascript" src="js/ajax.js"></script> 
    <link type="text/css" href="css/jquery-ui-1.8.6.custom.css" rel="stylesheet" /> 
    <script type="text/javascript" src="jss/jquery-1.4.2.min.js"></script> 
    <script type="text/javascript" src="jss/jquery-ui-1.8.6.custom.min.js"></script> 
    <script type="text/javascript" src="jss/jquery-watermarker-0.3.js"></script> 
    <style type="text/css"> 
     div.watermark 
     { 
      border:1px dashed #000; 
     } 
     img.watermark:hover{ 
      cursor:move; 
     } 
    </style> 

    <script type="text/javascript"> 
    //<!-- 
     $(document).ready(function(){ 
      $('#watermarked').Watermarker({ 
       watermark_img:  'a.png', 
       onChange:   showCoords 
      }); 
     }); 
     function showCoords(c) 
     { 
      $('#x').val(c.x); 
      $('#y').val(c.y); 
      $('#w').val(c.w); 
      $('#h').val(c.h); 
      $('#a').val(c.opacity); 
     }; 
    //--> 
     </script> 
     </head> 
    <body> 



    <h1>Image Watermark !</h1> 
    <br /> 
    X: <input type="text" id="x" name="x" value="" style="width:30px;" /> 
    Y: <input type="text" id="y" name="y" value="" style="width:30px;" /> 
    W: <input type="text" id="w" name="w" value="" style="width:30px;" /> 
    H: <input type="text" id="h" name="h" value="" style="width:30px;" /> 
    A: <input type="text" id="a" name="a" value="" style="width:30px;" /> 
    <hr /> 

    <img src="1.jpg" id="watermarked" /> 
    <br /> 
    Opacit&eacute;: <div id="sliderdiv" style="width:200px;"></div> 
    <br /> 
    <br /> 
    </body> 
    </html> 
+0

我認爲你缺少一個'<!DOCTYPE HTML!>'在頂O第一頁..這使得IE進入怪異模式 – Mottie

+0

它也可能有助於使用更接近IE9發佈日期發佈的jQuery的更新版本。在加載的腳本中使用document.ready時,您的問題可能與您的代碼運行順序相關。這個假設的問題是代碼將從上到下運行,並且由於文檔已經準備就緒,代碼將在html添加之前運行。 –

+0

你有沒有做過任何調試,例如將$(el).load更改爲$ .ajax來檢查響應文本和錯誤響應文本? –

回答

0

實際上,如果這是確切的代碼,你錯過了你的結束HTML標記是的,你應該定義一個適當的文檔類型:

第一html文件的代碼:

<html> 

應該是:

</html> 
相關問題