Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 1.08 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Appending variables to a string in javascript
  2. MyJavascriptClass.prototype.init = function() {
  3.     this.ToDate = $(this.Prefix + 'ToDate');
  4.     this.FromDate = $(this.Prefix + 'FromDate');
  5. }
  6.        
  7. MyJavascriptClass.prototype.btnClicked = function(evt) {
  8.  
  9. this.lnkShowLink.setAttribute('href', 'MyWebpage.aspx?StartDate=7/18/2012&EndDate=1/19/2012');
  10.  
  11. }
  12.        
  13. MyJavascriptClass.prototype.btnClicked = function(evt) {
  14.     this.lnkShowLink.setAttribute('href', 'MyWebpage.aspx?StartDate=' + this.ToDate.val() + '&EndDate=' + this.FromDate.val() + '');
  15. }
  16.        
  17. 'MyWebPage.aspx?StartDate=' + this.ToDate + '&EndDate=' + this.FromDate
  18.        
  19. var properties = [];
  20. for(var i in this)
  21.     if(this.hasOwnProperty(i))
  22.         properties.push(i+'='+this[i]);
  23. var url = 'MyWebPage.aspx?'+properties.join('&');
  24.        
  25. var string = "My name is: ",
  26.     name = "Bob",
  27.     punctuation = ".",
  28.  
  29.  
  30. greeting = string + name + punctuation;
  31.        
  32. var User = { name : "Bob", age : 32, sign : "Leo" },
  33. welcome = "Hi, I'm " + User.name + ", and I'm " + User.age + " years old, I'm a " + User.sign + ", and I enjoy long walks on the beach.";