Hi, Today, I did some tests of compatibility among IE 7.0.5730.11, Firefox 2.0.0.14, Opera 9.27, Safari 3.1.1 The following JSP(includes Javascrpt) works fine under all these browser. Then I used JQuery to implement the same function, it works fine under IE/FF/Safari The submit function does not work correctly under Opera.
Maybe I did not use Jquery correctly, or it is a compatibility problem of jquery-1.2.6. Thanks. Arden ===============Javascript========================================================= <?xml version="1.0" encoding="UTF-8" ?> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Insert title here</title> <script type="text/javascript"> var ipVal=0; function refreshProgress(){ ipVal = ipVal + 1; document.getElementById('test1').value=ipVal; setTimeout("refreshProgress()", 1500); } </script> </head> <body> <button id="buttonTest" onclick="setTimeout('refreshProgress()', 1500);">Click Me!</button> <form id="formtest" action="s.jsp" onsubmit="setTimeout('refreshProgress()', 1500);"> <input id="test1" type="text" name="fname" value="Default" /> <input type="submit" id="submitButton" value="submit"/> </form> </body> </html> =========================JQuery=============================================== <?xml version="1.0" encoding="UTF-8" ?> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Insert title here</title> <script type="text/javascript" src="<c:url value='/javascripts/jquery/jquery-1.2.6.js'/>"></script> <script type="text/javascript"> var ipVal=0; function refreshProgress(){ ipVal = ipVal + 1; $("#test1").val(ipVal); setTimeout(refreshProgress, 1500); } $(function(){ $("#buttonTest").click(function(){ setTimeout(refreshProgress, 1500); }); $("#formtest").submit(function(){ setTimeout(refreshProgress, 1500); }); }); </script> </head> <body> <button id="buttonTest">Click Me!</button> <form id="formtest" action="s.jsp" > <input id="test1" type="text" name="fname" value="Default" /> <input type="submit" id="submitButton" value="submit"/> </form> </body> </html> =========================s.jsp=============================================== <?xml version="1.0" encoding="UTF-8" ?> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <% Thread.sleep(10000); %> </head> <body> <button id="buttonTest">Click Me!</button> </body> </html>