Advertisement
saasbook

obtrusive_javascript.html

Aug 15th, 2013
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.86 KB | None | 0 0
  1. <html>
  2.   <head><title>Update Address</title></head>
  3.   <body>
  4.     <!-- BAD: embedding scripts directly in page, esp. in body -->
  5.     <script>
  6.     <!-- // BAD: "hide" script body in HTML comment
  7.         //  (modern browsers may not see script at all)
  8.      function checkValid() {    // BAD: checkValid is global
  9.        if !(fieldsValid(getElementById('addr'))) {
  10.          // BAD: > and < may confuse browser's HTML parser
  11.          alert('>>> Please fix errors & resubmit. <<<');
  12.      }
  13.    // BAD: "hide" end of HTML comment (l.3) in JS comment: -->
  14.     </script>
  15.     <!-- BAD: using HTML attributes for JS event handlers -->
  16.     <form onsubmit="return checkValid()" id="addr" action="/update">
  17.       <input onchange="RP.filter_adult" type="checkbox"/>
  18.       <!-- BAD: URL using 'javascript:' -->
  19.       <a href="javascript:back()">Go Back</a>
  20.     </form>
  21.   </body>
  22. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement