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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pull querystring into JS? 2

Status
Not open for further replies.

Mojojojo

Programmer
Jun 25, 2001
11
US
Thanks to vituz and dianal for helping me to this point...

I am stuck on a couple of simple things. I am trying to pull the querystring so that I can use it in javascript. My method below is not working. It is an ASP page.
When I use this from within a page and not the querystring it works ( I change the var object statement ).

I am opening a new page in the querystring and doing the below actions.

Any ideas of what I am doing wrong?

Thanks, (I vote positive for even remote assistance)

Joe

<SCRIPT LANGUAGE=JavaScript>

var object = <% Request.Querystring %>
var str=object.innerHTML;
document.write(str);
</script>
 
Hi joe,

I've adjusted your script just a bit.

Suppose you have an url like this one:
somepage.asp?text=sometext

<script language=&quot;JavaScript&quot;>
var str = <%=Request.QueryString(&quot;text&quot;)%>
document.write(str)
</script>

This should do it. Hope it does? :p

Kristof
 
Sorry, made a small error.

Forgot the '

<script language=&quot;JavaScript&quot;>
var str = '<%=Request.QueryString(&quot;text&quot;)%>'
document.write(str)
</script>

Bye ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top