Results 1 to 5 of 5

Thread: Killin me - Javascript!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    jmarcv's Avatar
    jmarcv is offline Cranky Coder
    Join Date
    Jan 2005
    Posts
    354

    Default

    Why wasnt I here sooner? I saw the prob in 5 seconds. Sorry!
    PS. Try that in php! <g>

    No language I know of lets you mix quotes like that without escaping them, and error 2 is, even if you did escape the inners, you are asking for a string containing +id+
    A simple alert(div) should have produced an error. Course, you have to know what to look for.
    div.hasChildNodes() is not a function!

    Why isnt it a function? Probably because div doesnt exist.

    Yeah JS is a bitch, and Firebug is the ****!

    I takes a whule to believe this, but when you do you will be a master Javascrip Jedi as well as a master glow Jedi.

    But keep in mind, strings are contained in matching pairs of quotes
    so
    var div = "document.getElementById("+id+")";

    that makes div a string of the object you want.
    Had you done div=eval(div); it would have worked, but your "ray of Light" was definately the correct way.

  2. #2
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default

    Jmarc,

    Thanks for the reply. Yes, I didn't catch it because I was alerting the div var, but it came out as a string. Somehow, I thought I could include a string as part of a procedure... Wrong!

    I'll have to look into eval() a bit more, but you're right - the obvious thing to do here is to do it right the first time.

    What I'm finding is that in development, you really have to be fluent in 3 languages - php / SQL / javascript. Add in CSS notation and you've got a 4th, but CSS really makes things easier, not harder - anything not to have to go back to nested tables...

    I've started messing around with the YUI connection manager for the AJAX requests thanks to your suggestion. There are so many out there, it's hard to say which one, but it's all about the same.

    Chas

Similar Threads

  1. Javascript html timed popup
    By andychev in forum General Support
    Replies: 0
    Last Post: 11-08-2006, 06:03 AM

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14