Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Does JS Code Need to be within HTML Tags

    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

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It would have to be properly wrapped in a document like this:

    <html>
    <head>
    <title></title>
    <script type="text/javascript">
    ...
    </script>
    </head>
    <body></body>
    </html>


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

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks.

    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •