Link to home
Start Free TrialLog in
Avatar of joe90kane

asked on

How to Auto Populate a text box with Page URL

Hi All,

I need to Auto Populate a text box with Page URL. Im not sure where to start.

I have the form but I need the script.

Thanks, Joe
Avatar of Göran Andersson
Göran Andersson
Flag of Sweden image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you are not using DOM-based, here's how to do it in forms.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<title>Third Santor</title>
window.onload = function(){
  var url = window.location.href;
  document.form1.The_Id_Of_The_TextBox.value = url;
<body onload="document.getElementById('The_Id_Of_The_TextBox').value=window.location.href;">
<form name="form1" method="post" action="" onsubmit="return ">
<input type="text" name="The_Id_Of_The_TextBox" value="" />	

Open in new window

Avatar of joe90kane


Worked Perfect - Thanks GreenGhost
I read your answer with interest. I have a similar situation where i have a form with a text box. I am attempting to find a solution to populate this textbox from a link to a URL that contains parcel id. For example: .

I would like to have my form capture this URL into a specific textbox.

ANY help would be greatly appreciated.