+ Reply to Thread
Results 1 to 9 of 9

Thread: error while giving src for <script> tag

  1. #1
    ambergarg22 is offline x10Hosting Member ambergarg22 is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    19

    error while giving src for <script> tag

    in my javascript i have a script tag which works fine.But the moment i mention a src to the script tag , it gives an error

    eg. <script language="javascript" src="audio-player.js">

    I have audio-player.js file uploaded in the same folder as the source HTML file.The error msg is "object expected"

    Plz help

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: error while giving src for <script> tag

    Do you have an URL where we can see this problem?
    Nothing is always absolutely so.

  3. #3
    ambergarg22 is offline x10Hosting Member ambergarg22 is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    19

    Re: error while giving src for <script> tag

    the URL is http://www.ambergarg.x10.mx/audio-plag1.html

    If u view the source code at line 31 u will see the <script> tag with src attribute.Although the error comes on the line where this function is called i think its due to src attribute.

    Now if u remove the src attribute , there is no error and the output is also displayed on the website

  4. #4
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: error while giving src for <script> tag

    "object expected" indicates that the script is loading and trying to access an undefined value. We'll need to see some code, a minimal test case. We'll also need a link to a live page for the minimal test case and an indication of which line is generating the error (mark it with a comment). Note that IE doesn't give correct line numbers; you'll need to use Firefox, Safari or some other, better browser.

    One thing you can do to help yourself (besides producing a minimal test case) is to use an interactive debugger, such as Firebug ([2], [3]; note: Firebug is a Firefox extension) to examine the values of the variables in the problematic statement and figure out why it's generating an error.
    Last edited by misson; 11-24-2010 at 06:11 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  5. #5
    ambergarg22 is offline x10Hosting Member ambergarg22 is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    19

    Re: error while giving src for <script> tag

    Actually the code was too long to be posted here and it will be cumbersome for ppl to look into so i thought it will be easier for ppl to Right click on the page and click "VIEW SOURCE" option and open in any editor and look on line 31 where my script tage begins.

    As for firefox is concerned , I dont hv permission on this computer to use that so i will have to be content with IE .How i identified the error in src attribute was the fact that the moment i remove the src attribute there is no error and the output is displayed for the webpage.

  6. #6
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: error while giving src for <script> tag

    Quote Originally Posted by ambergarg22 View Post
    Actually the code was too long to be posted here and it will be cumbersome for ppl to look into
    If it's too cumbersome to post, it's likely too cumbersome to look through on a live page, which is why I said to create a minimal test case. Read my sig.

    Quote Originally Posted by ambergarg22 View Post
    As for firefox is concerned , I dont hv permission on this computer to use that so i will have to be content with IE
    IE8 (if that's what you're using) has its own debugger. From what I recall, you don't need to install it.

    As for the linked page, the only error it generates is a 404 for the non-existent favicon.
    Last edited by misson; 11-25-2010 at 12:53 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  7. #7
    ambergarg22 is offline x10Hosting Member ambergarg22 is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    19

    Re: error while giving src for <script> tag

    I got the solution now.Thanks every1 who spent their time on this post. Actually there should have been 2 script tags , one for external js file and one for the functions defined in the source file.Its working fine now

  8. #8
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: error while giving src for <script> tag

    Do you mean you were doing something like the following?

    HTML Code:
    <script src="foo.js">
      function bar() { alert("foobar"); }
    </script>
    From the specification for the <source> element:
    The script may be defined within the contents of the SCRIPT element or in an external file. If the src attribute is not set, user agents must interpret the contents of the element as the script. If the src has a URI value, user agents must ignore the element's contents and retrieve the script via the URI.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  9. #9
    ambergarg22 is offline x10Hosting Member ambergarg22 is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    19

    Re: error while giving src for <script> tag

    @misson : yeah exactly , i didnt observed it till 5 hrs.But better late than never

+ Reply to Thread

Similar Threads

  1. Site giving 500 error
    By msk1999468 in forum Free Hosting
    Replies: 2
    Last Post: 11-23-2010, 01:41 PM
  2. Giving WordPress Its Own Directory ERROR
    By thegoldenpuffle61 in forum Free Hosting
    Replies: 29
    Last Post: 08-23-2010, 09:53 AM
  3. All pages giving a wierd compilation error
    By shdus1 in forum Free Hosting
    Replies: 10
    Last Post: 10-29-2009, 04:09 PM
  4. fsockopen() giving me a connection timed out error
    By shivany in forum Free Hosting
    Replies: 3
    Last Post: 10-19-2009, 10:23 AM
  5. Giving away a script from tufat.com
    By Christopher in forum Ads & Offers
    Replies: 0
    Last Post: 04-09-2008, 04:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers