$1 via PayPal for first correct answer in 20 minutes or less.

Discussion in 'JavaScript' started by RogerDodgr, Jul 22, 2009.

  1. #1
    Resolved
    No responses here --
     
    RogerDodgr, Jul 22, 2009 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    7


    Do I win?


    Anyway, you should post the question and answer here just in case somebody searches for it! :)
     
    crath, Jul 22, 2009 IP
  3. RogerDodgr

    RogerDodgr Well-Known Member

    Messages:
    267
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #3
    There was no answer in the 20 minute time constraint. There was no answer in a couple hours. I would have liked to have left it, but I removed the question just in case someone could not understand the simple logic of the 20-minute time constraint.:rolleyes:
     
    RogerDodgr, Jul 22, 2009 IP
  4. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #4
    well you can post the question anyway, it wouldn't have been in 20 minutes so you wouldn't be obligated to pay them if somebody answered :p but at least you'd get an answer
     
    crath, Jul 22, 2009 IP
  5. RogerDodgr

    RogerDodgr Well-Known Member

    Messages:
    267
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #5
    I'll do one better, I'll post the question AND the answer. (for learning purposes)

    Question:

    From HTML:
    
    <div id='calcLink'><a href='http://www.site.com'> site.com</a></div>
    
    Code (markup):
    From JavaScript file:
    
    var anchorTag= document.getElementById ('calcLink'). innerHTML;
    if (anchorTag != "<a href='http://www.site.com'> site.com</a>" ) { ...
    
    Code (markup):
    I'm trying to compare an anchor tag taken from innerHTML. I'm triggering this does-not-equal 'if' condition when they actually do equal (it should not be triggered).

    As a test, I scraped the anchor tag with innerHTML and placed the anchor tag in a 2nd location with inner HTML and everything worked perfectly. I think the problem might have to do with escape characters?

    (I'm copying and pasting in the original document, so i know the two tags are identical in the original document.)

    Answer:

    In addition to escaping the quotation marks, Javascript was converting the single quotation marks from the HTML into double quotation marks.
     
    RogerDodgr, Jul 22, 2009 IP