View Full Version : Does JS Code Need to be within HTML Tags

06-04-2003, 06:47 PM
I use frames for a complex webpage which is created on-the-fly based on cookie settings. It takes some time to load, so while it is being created you see a page that says please wait.

The page is then re-created each time the user takes an action to display the results.

The two pages are:

1. parent.image or index_image.html which contains HTML for the original page that is displayed for a few seconds while the actual page is being created.

2. parent.create or index_create.html which contains all the functions to run and re-create image as needed. OnLoad calls a function that re-creates image.

So you never see create, it just creates image and holds the functions to run things.

Finally, here's my question:

Do the variable statements, functions, and other JS code in create need to be withing HTML tags like HTML, HEAD, BODY and so on. Or can the page simply consist of:

var whatever=1;
functon whatever(){...

Thanks, Peter

06-04-2003, 08:05 PM
It would have to be properly wrapped in a document like this:

<script type="text/javascript">

Really, that's not too much code to worry about, right?

06-04-2003, 09:05 PM

Right, but to find what's causing a problem I'm having I'm trying to remove all unnecessary coding and I just got to wondering if it was even necessary.