Hi, I am trying to write a piece of javascript that will open a popup and include the the text from a textbox in the url. See below what I have so far. The javascript fires ok but instead of picking up the text from the box it keeps opening the url: ....AddClaimPerson.aspx?name=undefined Does anyone know where I am going wrong? thanks advance rich code: function DoPersonRedirect(control) { var search = control.value; var person = window.open('AddClaimPerson.aspx?name=' + search); }
What weirdwes was getting at is right - your function works, but you probably aren't calling it correctly. <script> function DoPersonRedirect(control) { var search = control.value; var person = window.open('AddClaimPerson.aspx?name=' + search); } </script> <input type="text" id="MyText"> <input type="button" value="Click to Test" onClick="javascript:DoPersonRedirect(document.getElementById('MyText'))"> Code (markup): This shows how to pass the control into your function. Cheers.