I have made code with comments below:
which is storing value from url=> ../webdev/dummy.html?foo=quora, now my query is I want to show quora in textbox at the page load only, I don't want to use onclick function.please guide me :)
dummy.html
<script type="text/javascript">
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var foo = getParameterByName('foo');
document.getElementsByName('subject').Value = foo; // this is I am thinking of to store value in textbox id="subject"
</script>
<input type="text" name="subject" id="subject" readonly="true" />
<!-- textbox to display "quora" -->
it is not displaying any value in textbox