SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: 'url' undefined

  1. #1
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    'url' undefined

    I keep getting the error:

    Line: 34
    Char: 2
    Error: 'url' is undefined
    Code: 0

    However, I don't have a "url" anywhere in my page and everything on line "34" seems to be correct.. I'm stumped...

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    need to post some code there buddy ....... both the call to the function AND the javascript ...

  3. #3
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats what I'm saying. What counts as a "line"? If i look at the source code in my php page, line "34" is php code. If i look at line 34 by viewing the page in IE and then viewing source, line 34 is "<br />".

  4. #4
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it has to do something with this:

    if (!(parseInt(navigator.appVersion)==4 && navigator.appName=="Netscape")) { // skippa ns4
    document.write('<link rel="stylesheet" type="text/css" href="'+url+stylePrefix+styleEnd+'" /'+gt);
    }

  5. #5
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoobyWho
    I think it has to do something with this:

    if (!(parseInt(navigator.appVersion)==4 && navigator.appName=="Netscape")) { // skippa ns4
    document.write('<link rel="stylesheet" type="text/css" href="'+url+stylePrefix+styleEnd+'" /'+gt);
    }
    OH OH OH I see what your saying! Isnt it fun trying to decypher javascript in another language? NO ? I agree and thats one GREAT reason to get it into external files! When you embed something like javascript into PHP, ASP or any other language you have to copy and paste the source code of the page (from the browser - view source) and then find the line number that way.... A REAL PAIN IN THE BACKSIDE!

    Anyways I digress (sorry, its the teacher in me coming out! )

    Where did you declare that url variable? thats probably where its coming from. You have to remember computers look at your code and say "OK, Ive got a variable called url thats being used here .... now what is it exactly and what is it storing?"

    Is that variable declared in the function someplace??? IE: var url = something? Or is it being passed into a function like this:

    function doSomething(url) {
    }

    because if its not thats exactly what its complaining about ..... it literally doesnt know what url is!

    If you have an entire function slap it up here and we'll take a look .... Im sure its nothing major .... just a missing declaration or something!

    Oh and one last thing about the line number .... its not always 100% right as the browser sometimes interprets lines differently that you see them in an editor .... so you have to hunt around some .... but it shouldnt be to far from the line number it gives you..... Ive seen some browsers interpret an entire js function as one line of code because its NOT seeing the hard returns you see in your fav editor.


Bookmarks

Posting Permissions

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