Make your own free website on Tripod.com


JAVASCRIPT FREQUENTLY ASKED QUESTIONS

Q: I'm in the CU 2900 course. The assignment 1 works OK. in IE4 but for the life of me it will not work with Netscape. I don't understand why it is not enclosed in <SCRIPT LANGUAGE=.... etc. Netscape tells me that I need to insert tags. But what tags? Also I've tried a number of things in the Netscape editor that returned only the text and so did not execute. Finally I used notepad with some success. Help!! I'm running Netscape 4.73. Answer

Answers

Q: I'm in the CU 2900 course. The assignment 1 works OK. in IE4 but for the life of me it will not work with Netscape. I don't understand why it is not enclosed in <SCRIPT LANGUAGE=.... etc. Netscape tells me that I need to insert tags. But what tags? Also I've tried a number of things in the Netscape editor that returned only the text and so did not execute. Finally I used notepad with some success. Help!! I'm running Netscape 4.73.

A: You've brought up several interesting questions. You'll probably have the feeling "You wish you knew the material at the end of the book" at the beginning of the course. The case of the script tags is one such case where you work according to the examples until you hit chapter 12. In reality you need the first 10 chapters of the book before you can effectively write JavaScript but that would leave little time for practicing what you learned and so we have simple exercises that build to greater complexity as the course progresses. There are actually 7 ways to include JavaScript in HTML. In your first exercise you are using a single statement to define an event handler (text p 216-217). Unless you use more than a couple of lines you don't need the <SCRIPT> </SCRIPT> tags here.

The second part of your question involves the difference between IE and Netscape. If you include Event Handlers as section 12.2.3 in your text outlines, they will work fine in IE4+ but need to be enclosed within a <FORM> </FORM> pair to work in Navigator. Examine your corrected code which I will attach. This code will work in both IE4+ and Navigator. You might ask why there is a difference. There are a couple of reasons. Microsoft and Netscape developed different versions of JavaScript. Microsoft calls their version "JScript" which can be confusing because even I abbreviate JavaScript as JScript. In addition with each new browser release both companies remove and add features to move toward compliance with the international standard. Notice I said "move" because the standard is changing rapidly. The text you are using teaches version 1.2 but the standard has moved beyond that. The text however, is one of the more thorough available and hopefully will be updated.

You have brought up one additional issue. What is the best method to write and edit your scripts? Even to this day many purists will only use notepad or some other text editor to write HTML. I like to use a combination of text editor and automatic code creation with Microsoft Front Page. You can download the Front Page editor as a component of Microsoft Internet Explorer. Go to the Microsoft site and download the setup program (about 600k) and then you can add and delete components). The full IE5.01 is about 38meg with all of the options and a couple of foreign languages. You'll need IE5.01 later for VBS so you might want to grab it when you have the time. Front Page editor is convenient in that you can switch between HTML and Normal and Preview modes. The normal mode is a high level mode that generates HTML code automatically just as Netscape Composer.

You can then switch to HTML mode to write scripts. The major disadvantage to either Composer or Front Page editor is not being able to run the scripts line by line. Instead you have to use "document.write" to output the variable values at various points of your script.

There are other alternatives such as JBuilder from Borland. Most applications can be downloaded in trial form but get ready for a 30-80meg download.

The first exercise was designed to help you formulate just the types of questions you raised. Let me know if this answers all of your questions. Also, any feedback on the course material is greatly appreciated.|Back to Top|

All pictures and material Copyright 1998 - 2004, A+ copyright Comptia, CCNA copyright Cisco Systems.  This page is optimized for Internet Explorer 6.0 at 800 x 600 resolution For problems or questions regarding this web contact [Webmaster]. Last updated: April 20, 2004.