htmlform1.aspx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <%@ Page Language="C#" %>
  2. <html>
  3. <head>
  4. <title>HtmlForm test</title>
  5. </head>
  6. <body onload="check_src()">
  7. <script language="javascript" type="text/javascript">
  8. function get_elem(id) {
  9. return (document.getElementById) ? document.getElementById (id) :
  10. ((document.all) ? document.all [id] : null);
  11. }
  12. function test_attrib(elem, attr, out_come_name, name, present) {
  13. var out_come = get_elem (out_come_name);
  14. if (!elem.hasAttribute) {
  15. out_come.innerHTML = "IE sucks!";
  16. out_come.className = "failed";
  17. } else {
  18. if (elem.hasAttribute (attr) != present) {
  19. out_come.innerHTML = name + " test failed";
  20. out_come.className = "failed";
  21. } else {
  22. out_come.innerHTML = name + " test passed";
  23. out_come.className = "passed";
  24. }
  25. }
  26. }
  27. function check_src () {
  28. var elem = get_elem ("form1");
  29. if (elem) {
  30. // These attributes should always be present
  31. test_attrib (elem, "name", "outcome_name", "Name", true);
  32. test_attrib (elem, "method", "outcome_method", "Method", true);
  33. test_attrib (elem, "action", "outcome_action", "Action", true);
  34. test_attrib (elem, "id", "outcome_id", "ID", true);
  35. // Test for attributes that should NOT be there
  36. test_attrib (elem, "enctype", "outcome_enctype", "Enctype", false);
  37. test_attrib (elem, "target", "outcome_target", "Target", false);
  38. test_attrib (elem, "wibble", "outcome_wibble", "Wibble", false);
  39. }
  40. }
  41. </script>
  42. <style type="text/css" media="screen">
  43. <!--
  44. .passed { background-color: green; color: white;}
  45. .failed { background-color: red; color: white;}
  46. -->
  47. </style>
  48. <form id="form1" enctype="" target="" runat="server" />
  49. <div id="outcome_name" class="">Default text. Should not be seen.</div>
  50. <div id="outcome_method" class="">Default text. Should not be seen.</div>
  51. <div id="outcome_action" class="">Default text. Should not be seen.</div>
  52. <div id="outcome_id" class="">Default text. Should not be seen.</div>
  53. <div id="outcome_enctype" class="">Default text. Should not be seen.</div>
  54. <div id="outcome_target" class="">Default text. Should not be seen.</div>
  55. <div id="outcome_wibble" class="">Default text. Should not be seen.</div>
  56. </body>
  57. </html>