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

    Short question: Code in SRC of a .js not working

    Hi. The problem: I have a .html page and there, via src="base.js",
    i am fetching some javascript of it.
    Now the JS code in particular involves document and submit and is short. (after the function name, its document.formular5.submit(); )

    If i put the JS in the .html page via
    <script language="javascript">
    </script>

    it works.
    If I put it into a .js file, it no longer works.
    I would like to get it to work because I will have to rely on this JS code for several html-pages and adding JS into each html page is not how i would like to see this solved.


    I suspect that something either with the submit or the document is not correct (in the .js file).

    If someone would have an idea what could be wrong ?

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Surrey, UK
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If the code is identical, the problem could be that you have <script> </script> tags in your base.js file. There should'nt be any. Just the content of the javascript itself.

  • #3
    New to the CF scene
    Join Date
    Mar 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply. I haven't put </script> tags into the .js file anywhere, no < > at all actually. What is strange, a slightly different version of the script works fine in another .html page.
    Guess something is bugged with my software

    But anyway, can I refer from the .js file to a specific .html page ?

    Like open a new .html page (from the .js file) and applying a change to this newly opened .html page lateron ?

    I remember that I have had some problems to add huge
    javascript code into .js file some months ago.

  • #4
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    can we see the code, or a link to the page this is on?
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.


  •  

    Posting Permissions

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