how do you write into a getElement

Discussion in 'JavaScript' started by MyVodaFone, Jun 9, 2010.

  1. #1
    Function:
    
    var baseURL = self.location.href;
    
    baseURL = baseURL.split("/").slice(0,3).join("/")+"/";
    
    Code (markup):
    document.getElementById(id).src = "'+baseURL+'/style/images/b.gif";
    Code (markup):
    The above wont write the base url '+baseURL+'

    EDIT: I got it, should have been double quotes "+baseURL+"
     
    Last edited: Jun 9, 2010
    MyVodaFone, Jun 9, 2010 IP
  2. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    document.getElementById("idName").src = baseURL+"/style/images/b.gif";
     
    krsix, Jun 9, 2010 IP