#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2010
    Posts
    59
    Rep Power
    0

    Run automatically with the launch of a a webpage


    I have this javascript program.

    I have not worked much in javascript with ASP.net.

    Can you get this function to run automatically with the launch of a aspx webpage and put the value in TextBox1?

    Code:
    function getParameterByName(name)
    {
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.search);
      if(results == null)
        return "";
      else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
    }
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,124
    Rep Power
    119
    Yes... you do it like this:

    Code:
    window.onload = function() {
    getParameterByName('John Doe');
    }

IMN logo majestic logo threadwatch logo seochat tools logo