Results 1 to 1 of 1

Thread: JS reference (not in head)!

  1. #1
    Join Date
    Sep 2008
    Posts
    899

    JS reference (not in head)!

    I just discovered that I don't have to put my <script src="comm6.js" type="text/javascript"></script> in the head of my document to make it accessable to an OnClick. I can put it in the body before the OnClick and it works like a charm. How 'bout that!

    I've got quite a HUGE number of includes. I needed to give a unique js script to each individual include depending on the varied number of checkbox options in each include. The includes (3500+ of them) will have from 2 checkbox options to 132 checkbox options. The includes initially display with the "choose all" box checked. That's so the processed form's output page will display the results with all of the parameters (choices) included if the user doesn't do anything but click the "view" (submit) button. The JS script removes the "checked" from the "choose all" box when any of the other boxes are checked. It also puts the "checked" back in the "choose all" box, and removes the checks from all the other boxes, when the user attempts to check all the choices (other than "choose all" of course). And it displays the alert "You must choose at least one option" if the user removes all checks from all boxes. And after the user closes the alert (by clicking "OK"), it puts a check back into the "choose all" box. Kind of like starting fresh.

    I didn't want to have to reference to one extremely huge js library file on this particular php page. Not having to put my reference(s) in the head will enable me to put the unique references in the appropriate includes. That way I'm only referencing one small js file per include/page.

    I'm such a happy camper about this, I just had to post it.
    Last edited by djlebarron; 19 Dec 2008 at 09:19 AM.

Similar Threads

  1. IE DOM reference - No fun at all
    By wdf2006 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 25 Jul 2006, 09:25 PM
  2. Help! Any recommend Javascript Reference Website
    By chickenwing in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 01 Jul 2006, 12:04 AM

Posting Permissions

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