Request.QueryString w/o ASP?

J

jp2express

Does Request.QueryString need to be carried out using ASP, or can JavaScript
handle this?

I know it is simple, but I've never done it and I don't know what to search
for.

Say I wanted my default web page to display my projects. I want to be able
to pass a link like this:

www.joeswelding.biz/index.htm?page=projects

Do I need to change my index page to ASP to do this? I know it isn't hard to
change, but I hate not knowing another way (like JavaScript) to do things
(like QueryString).

Regards!
Joe
 
E

Evertjan.

jp2express wrote on 05 jan 2008 in
microsoft.public.inetserver.asp.general:
Does Request.QueryString need to be carried out using ASP, or can
JavaScript handle this?

Your Q is impossible to anwer directly,
since you presume things that are not true:

On topic:

Yes, Request.QueryString needs to be carried out using ASP.

But:

ASP is not a language, but a serverside platform,
having the Request object.

Yes, Javascript can be used serverside on the ASP platform,
and so can use the Request object.

Off topic:

No, clientside Javascript does not have access to a Request object.

Yes, clientside Javascript can get the querystring,
not using a request object,
but using window.location.search.
 
J

jp2express

Thanks! That's what I was looking for. I guess JavaScript doesn't have a
neat client side version.

Evertjan, if you are reading this, sorry to have upset you, but how do you
ask a question if you don't know the proper way to phrase it? I didn't know
if a JavaScript technique was client side or server side, but the fact that
I did not want to turn my HTML page into an ASP page should have answered
your question.

Thanks for the help!

McKirahan said:
jp2express said:
Does Request.QueryString need to be carried out using ASP, or can JavaScript
handle this?
Yes.

I know it is simple, but I've never done it and I don't know what to search
for.

Say I wanted my default web page to display my projects. I want to be
able
to pass a link like this:

www.joeswelding.biz/index.htm?page=projects

Do I need to change my index page to ASP to do this? I know it isn't hard to
change, but I hate not knowing another way (like JavaScript) to do things
(like QueryString).


Will this help?

<html>
<head>
<title>index.htm</title>
<script type="text/javascript">
window.onload = function() {
var qstr = unescape(location.search);
if (qstr.length == 0) return;
qstr = qstr.substr(1);
var pair = qstr.split("=");
if (pair[0] == "page") {
if (pair[1] == "projects") alert("PROJECTS!");
if (pair[1] == "something") alert("SOMETHING!");
}
}
</script>
</head>
<body>
</body>
</html>
 
B

Bob Barrows [MVP]

jp2express said:
Thanks! That's what I was looking for. I guess JavaScript doesn't
have a neat client side version.

Evertjan, if you are reading this, sorry to have upset you,

Given that he answered your question, I'm not sure how you can say he was
upset. Beware of trying to read emotion into text messages, especially those
from people whose first language is not English.
but how
do you ask a question if you don't know the proper way to phrase it?

The phrasing was not the issue.
I didn't know if a JavaScript technique was client side or server
side,

It can be either. Javascript is a scripting language that can be used in
either server-side or client-side code.
but the fact that I did not want to turn my HTML page into an
ASP page should have answered your question.
As well as your own. If it's not a .asp page, then it's not an "asp"
question, now is it? It pretty much HAS to involve client-side code, which
is better handled in a client-side scripting group like
microsoft.public.scripting.jscript or comp.lang.javascript.

Again, do not read this as a rebuke: it is intended to help you get help
more efficiently in the future.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top