Copy / Paste Help Continued


Common Problems With Scripts

Error messages with Internet Explorer and Netscape Navigator
IE error iamge    

Look very carefully at the original script and compare it to what has been pasted into your page.

Sometimes, when the cut and paste code contains comments, the comments get wrapped around the working code which then thinks it's part of the comment and (like all good comments) takes no part in the action. Spot the differences and fix the code.

Sample script - as shown it works (prints Hello World):

<script type="text/javascript">
<!--
document.write('Hello World')
// -->
</script>

Same original - does nothing because the real script line has been added to the comment.

<script type="text/javascript">
<!--document.write('Hello World')// -->
</script>

Same original - gives an error because the script line has been split into two

<script type="text/javascript">
<!--
document.write
('Hello World')
// -->
</script>

Same original - gives an error because a line break is not a javascript command (often occurs with webTV).

<script type="text/javascript"><BR>
<!--<BR>
document.write('Hello World')<BR>
// --><BR>
</script>

Always be very careful pasting javascripts. Make sure you or your editor does not generate these errors.