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 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Netscape External JS file working fine in IE, NS4 but not in NS6

    Hi!

    I got this code from JavaScriptKit.com. The orignal script has the code embedded in the html file. I managed to get it working as an external .js file in IE6 and NS4 but in NS6 its a no-go.

    The orignal code works fine in NS6 so the code by its self is compatible with it.

    Ne ideas? Thanks in Advance !

    RS
    Attached Files Attached Files

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    TEXAS . . . 'nuf said
    Posts
    468
    Thanks
    0
    Thanked 0 Times in 0 Posts
    All I know is that I've experienced this problem before with another JS. And as you can guess, my "fix" was to not use the external JS file. Being that the JS was to be included in all of my pages on the site, it's just a pain. But, no other solution was ever found.
    Gordo
    "In the End, we will remember not the words of our enemies, but the silence of our friends."
    - Martin Luther King Jr. (1929-1968)

  • #3
    New Coder
    Join Date
    Jul 2002
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    NS6 is very picky about quotation usage sometimes... the only reason NS6 isn't working with your external .js file is because in the <script> line, you don't have quotation marks around the filename... so while you have
    <SCRIPT LANGUAGE='JavaScript' src=triplecombo.js></script>
    you should have
    <SCRIPT LANGUAGE='JavaScript' src='triplecombo.js'></script>

    Tested it on mine and it works.

  • #4
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Ouch!

    Inserting and maintaining the code in every page will be a real bummer

    And inserting the quotes around triplecombo.js didnt work on ns6 here Am using 6.2, could that be a reason?

    One more thing though, just read abt the javascript console help in netscape ... it gives the following Error: document.isc has no properties ...

    do you think with NS6 and its "new engine" objects like forms in external files would have to be created using DOM/JavaScripting?

    Currently the script uses a document.write("<form></form>") to create a form ... Could this be the problem?

    Anyways, thanks for your help

    RS
    Last edited by thevice; 08-05-2002 at 05:02 AM.

  • #5
    New Coder
    Join Date
    Jul 2002
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thevice, I'm not sure if you missed my post or what, but the only problem in your code is that you don't have quotation marks around the file name... if you just add quotation marks, you won't have to insert the code into every page, because the external .js file will work...

  • #6
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I had missed your post ... and while i was editing the reply, missed your next one

    A nice bit o' comedy of errors

    Really appreciate your help!

    RS

  • #7
    New Coder
    Join Date
    Jul 2002
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Heh, well, I found the real problem this time... the reason I thought the quotes were the problem was because I was playing with two things at once, so when it started working, I thought it was the quotations, when really it was the other thing...
    So anyway, the reason it doesn't work is because NS 6 does some really weird things when you try writing a <script> tag when you're already inside another <script> tag... in the example from your download, you had something like this:

    <script>
    if (document.all || document.layers)
    document.write("<SCRIPT LANGUAGE='JavaScript' src=triplecombo.js></script>")
    else
    document.write("<SCRIPT LANGUAGE='JavaScript' src=triplecombo.js></script> ")
    </script>


    Most of that code is completely redundant... if you write this instead, it should work:

    <SCRIPT LANGUAGE='Javascript' src='triplecombo.js'></SCRIPT>

    That works for me in NS 6.2

  • #8
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Great! It works!

    BUT (isnt there always a but?) ...

    the reason for those lines of code were to enable the browser to pick up code from an external file say a.js if it were ie/netscape4 and b.js if it was netscape6up.

    Is there a way to include an external file without the <script src> tags?

    RS

  • #9
    New Coder
    Join Date
    Jul 2002
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, while trying to answer this, I thought up trying to change the src of the current <script> tag dynamically... while this works in IE, Netscape doesn't seem to like people messing with script src's dynamically and throws some weird errors...

    Anyway, all that I've managed to thinkup that would work is either try using iframes to include the script file (I'm not sure it would work, and you would have to change the js file a bit... I don't really use them, so I don't know...), or you could try combining your two .js files (the one for NS6 and the one for the others) into a single .js file - all you would have to do is make a new .js file, write if (document.all||document.layers){, then copy and paste your script for IE/NN, then put an 'else' after that and put your NS6 script...

  • #10
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    try slicing the word script in the document.write. Sometimes browsers mess up when finding script tags in document.write's.

    <script>
    if (document.all || document.layers)
    document.write("<S"+"CRIPT LANGUAGE='JavaScript' src=triplecombo.js><\/script>")
    else
    document.write("<S"+"CRIPT LANGUAGE='JavaScript' src=triplecombo_ns6.js><\/script> ")
    </script>

  • #11
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool

    Sorry i took a long time to reply ...

    Neways ... the slicing etc didn't help ... but noticed that ther error document.isc has no properties could only mean that somehow ns6 was not recognising the form being created by the external script ... took a wild shot and moved the document.write(<form ..> ... </form>); part to the main page and it worked! finally moved the that form to another external js file and added another loop to execute the combobox script(dint wrk in the same loop) and its wrkg real fine

    I guess NS6 is real picky about hierachy and in fact seemingly everything else ... which may be a good thing after all!

    Thanks to everyone for your help! would have given up on this one if it wasnt for you'll!

    RS

    p.s. attaching the complete set of files in case anyone is interested!
    Attached Files Attached Files


  •  

    Posting Permissions

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