math within an document.getElementById tag?

Discussion in 'Software' started by darkhorizon, May 1, 2006.

  1. darkhorizon

    darkhorizon Private First Class

    caution: newbie javascript question

    let update[2] = 10 just for arguments sake

    Code:
    document.getElementById("next").innerHTML = "<a href=\"javascript:sndReq('nextImage|" + update[2]+1 + "')\">Next Image</a><br>";
    im learning ajax, but having never known javascript, but i did take a course on java in college

    my question is, the variable update[2]+1 should print out 11 if update[2] is 10, but instead, it comes up with 101, it just adds the one onto the end of 10, so i thought maybe its a string? so i tried to parseInt it, and still no go, help plz?
     
  2. Kodo

    Kodo SNATCHSQUATCH

    eval(parseInt(update[2])+1)
     
  3. darkhorizon

    darkhorizon Private First Class


MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds