Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Querystring help

Status
Not open for further replies.

jakeyg

Programmer
Mar 2, 2005
517
0
0
GB
I'm trying to pass a querystring to a page.
The pID is passed into my page and get's caught using

<% pID = Request.QueryString("pID") %>

then I try to call the next page using this code

<script language="javascript" type="text/javascript">
<!--
function popupHA()
{ window.open("HA.asp?PropID=<%=pID%>");}
-->
</script>

and the page loads fine but the pID hasn't been passed along.

The only indication I've got that anything is wrong is that Interdev doesn't highlight the <% & %> markers in yellow in the script block but if I copy <%=pID%> outside the script block it does

I've used the code before and it worked fine

There's a Janus grid on the page which might be causing problems but I've no idea how

thanks
 
The page will render all javascript before any logic is called. You must make sure to assign the value of pID BEFORE you create the function popupHA().

If your code looks like this (approx):

<body>
<script language="javascript" type="text/javascript">
<!--
function popupHA()
{ window.open("HA.asp?PropID=<%=pID%>");}
-->
</script>
</body>
<%call getParameters()%>

...and the value of pID is set in the getParameters() function, then when the javascript function is rendered, there is no value yet for pID. You must move the "call" above the creation of the javascript function.

Does this solve your issue?
 
incorrect.
asp (which this is) is completed on the server side. therefore, <%= pID %> should print out just fine prior to sending data to the browser. If pID had a value of 3, then that line of javascript, when a View > Source is done, should be

window.open("HA.asp?PropID=3");

*cLFlaVA
----------------------------
[tt]clean slate...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Alright, whatever. I've had this problem before. I just moved the function the the very bottom of the page, and it fixed the issue. The parameter was sent and received without any problems.
 
The request is at the top and the script is at the bottom

With <%=pID%> just above the javascript block it displays the value on the page ok, it's just within the block that the value doesn't exist
 

it displays the value on the page ok, it's just within the block that the value doesn't exist

So are you saying that the value does show up when you view source (in the window.open line) but still does not get passed through?

Dan


The answers you get are only as good as the information you give!

 
It's started working
no idea why [censored]
thanks for the help guys
 
What does *** say when you view source?

{ window.open("HA.asp?PropID=***");}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top