读书人

JQUERY $(quot;form:firstquot;).submit();在I

发布时间: 2012-02-04 15:43:08 作者: rapoo

JQUERY $("form:first").submit();在IE6下面不执行,咱整
JQUERY $("form:first").submit();在IE6下面不执行,咱整

[解决办法]

HTML code
<!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=gb2312" /><title>无标题文档</title><style>  p { margin:0; color:blue; }  div,p { margin-left:10px; }  span { color:red; }</style><script src="http://code.jquery.com/jquery-latest.js"></script></head><body><p>Type 'correct' to validate.</p><form action="javascript:alert('success!');">    <div>      <input type="text" />      <input type="submit" />    </div></form>  <span></span><script>    $("form:first").submit(function() {      if ($("input:first").val() == "correct") {        $("span").text("Validated...").show();        return true;      }      $("span").text("Not valid!").show().fadeOut(3000);      return false;    });</script></body></html> 

读书人网 >JavaScript

热点推荐