1/31/10

jQuery Template Page

This page can be used for quick-start jQuery development.
jQuery v1.4.x is loaded from the Google AJAX Libraries API site.
Page caching is disabled via meta tags to make it easy to test changes.
<!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>
<title>jQuery Template</title>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<style type="text/css">body,input,button{font-family:Verdana,Sans-Serif;font-size:.9em;}</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
  //$(document).ready(function(){alert('DOM ready');});
  //$(document).ready(f1);
  function f1()
  {
    alert('f1() - DOM ready');
  }

  function f2()
  {
    var input = $.trim($("#input1").val());
    $("#label1").text(input);
  }
</script>
</head>
<body>
  <!--form & submit button allows user to submit by pressing enter key 
    while input text box has focus - instead of having to manually click 
    button or tabbing to button and pressing space key-->
  <form action="">
    <label id="label1">label1</label><br />
    <input id="input1" type="text" maxlength="32" title="input" /><br />
    <input type="submit" />
  </form>
  
  <script type="text/javascript">
    $("form").submit(function(){f2(); return false;});
  </script>
</body>
</html>

No comments:

Post a Comment