Pass parameter to document.getElementById

User avatar
Jezza
5StarLounger
Posts: 847
Joined: 24 Jan 2010, 06:35
Location: A Magic Forest in Deepest, Darkest, Kent

Pass parameter to document.getElementById

Post by Jezza »

This is driving me crazy...

I have a URL http://myserver/map.asp?PCode=ABC123" onclick="window.open(this.href);return false;

and want to pass PCode (ABC123) into a text box txtLocation, I can get it in by hardcoding

The snippet of code looks thus:

function requestPosition()

{

document.getElementById("txtLocation").value = 'ABC123';

...


However the parameter will obviously change, I have tried
<% strPostCode = Request.querystring("PCode") %>

then

document.getElementById("txtLocation").value = strPostCode;

and various different options but cannot get the variable to stick, any ideas?
Jerry
I’ll be more enthusiastic about encouraging thinking outside the box when there’s evidence of any thinking going on inside it

User avatar
Jezza
5StarLounger
Posts: 847
Joined: 24 Jan 2010, 06:35
Location: A Magic Forest in Deepest, Darkest, Kent

Re: Pass parameter to document.getElementById

Post by Jezza »

Got it ...stored it as

<%
PC = request.querystring("PCode")
%>

then added value = "<%= PC %>" to an input tag
Jerry
I’ll be more enthusiastic about encouraging thinking outside the box when there’s evidence of any thinking going on inside it