Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. external javascript not working

external javascript not working

Scheduled Pinned Locked Moved JavaScript
javascripthtmltoolsxml
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nordyck
    wrote on last edited by
    #1

    I'm having problems with external js file. When the function is within the html page, it works fine. as soon as I reference it to external source it doesn't. External file: xml.js function helloworld1() { document.write(

    helloworld world

    ); return } web page: function helloworld1() { document.write("helloworld world"); return } </head> <body> <script type="text/javascript"> var m = helloworld(); Click me to display Date and Time.

    Kornfeld Eliyahu PeterK L 2 Replies Last reply
    0
    • N nordyck

      I'm having problems with external js file. When the function is within the html page, it works fine. as soon as I reference it to external source it doesn't. External file: xml.js function helloworld1() { document.write(

      helloworld world

      ); return } web page: function helloworld1() { document.write("helloworld world"); return } </head> <body> <script type="text/javascript"> var m = helloworld(); Click me to display Date and Time.

      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu Peter
      wrote on last edited by
      #2

      Probably your reference is wrong...It may be src="xml.js" or some ore complicated path...Use the built in debugger of your browser and check console messages to see if the external file was loaded at all...

      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

      "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

      U 1 Reply Last reply
      0
      • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

        Probably your reference is wrong...It may be src="xml.js" or some ore complicated path...Use the built in debugger of your browser and check console messages to see if the external file was loaded at all...

        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

        U Offline
        U Offline
        User 11699443
        wrote on last edited by
        #3

        but i can put alert messages in there and they get fired off in other parts of the same script section you get variables from the database there in that edit form sitting in the controls mostly textboxes and then when clicking submit they all get sent into the db to update the db table so in the html the variable is there, sometimes its visible in the alert("value is: "+ $'(variablename).val')); but if the variable.val() isnull or == null or == "" then it should set that variable.val() = "No"; sometimes it works, sometimes not this is with a handler that runs after the window.load ? when the DOM is fully ready and all the images are drawn, then it runs code to check for certain null values and if null replace that with string 'no' otherwise dont care. thanks

        1 Reply Last reply
        0
        • N nordyck

          I'm having problems with external js file. When the function is within the html page, it works fine. as soon as I reference it to external source it doesn't. External file: xml.js function helloworld1() { document.write(

          helloworld world

          ); return } web page: function helloworld1() { document.write("helloworld world"); return } </head> <body> <script type="text/javascript"> var m = helloworld(); Click me to display Date and Time.

          L Offline
          L Offline
          Leng Vang
          wrote on last edited by
          #4

          It works the same. Your problem may be timing issue. The provided code doesn't show the usage of the xml functions and I'm assuming you execute some xml function while the xml.js is being loaded. Before you make any call to functions defined in the xml.js file, you have to make sure that the file has been loaded successful.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups