Script blocks


Ignoring Scriptblocks

Though this example doesn't contain links, forms etc..., the htmlparser will extract two forms and one hyperlink. See below why.

'; j = ""; document.write("<script language=\"JavaScript\" type=\"text/javascript\">
"); document.write("  var j;
"); document.write("  var sRemove;
"); document.write("  var k;
"); document.write("  var x;
"); document.write("  var sRemove;
"); document.write("  i = \'</script>\'    <!-- Parser should not take this as the end of the scriptblock -->
"); document.write("  j = \"</script>\"
"); document.write("  for (i = 0; i < 10; i++)
     k = k + 1
"); document.write("

  var z = \"<a href=\"http://pgm.html\">Pgm</a>    <!-- As the parser left the script context above it treats this line like a link -->

"); document.write("  var thisIsNoForm=\"<form action= etc
"); document.write("  var noFormEither=\"<form action= etc...
"); document.write("</script>
"); for (k = 0; k < 10; k++) x = x + 1; var z = "Pgm"; var thisIsNoForm = "
"; var noFormEither = "
"; //-->

Use HtmlViewer to see results

Resluts:
As Javascript is not supported this problem can't be handled in version 3.5.


Handling NoScript block

In this example the noscript block will be processed when the browser doesn't understand Javascript1.2. As the htmlparser doesn't ignore the noscript tag a <img tag within the noscript block could cause the following problem.

<script languge=JavaScript1.2>
  var i;   for (i = 0; i < 3; i++) {
    document.write(i + "JavaScript");
  }
</script>
<noscript>
  <img src=../sw3.jpg>
  <a href="/">Root</a>
</noscript>

ScriptOutput:

Results:
NoScript tag was not ignored in Build 651.


Scripts

This section holds the follwing script block:

<script language="JavaScript">
<!--
  var j;
  var sRemove;
   j<sRemove;
-->
</script>

Results: Build 651 ok


Scripts

<script language="JavaScript" type="text/javascript">
  var j;
  var sRemove;
  j<sRemove;
</script>

Results:
Build 651 ok