But surely if you are using ASP you can do the following:
URL :
http://www.testsite.com/test.asp?Com...omputer%20Corp
<% varCompany = Request.QueryString("Company") %>
to extract from the URL to variable varCompany
and where you need to place the variable:
<%= varCompany %>
all in ASP
The only bit using VB of Javascript is the creation of the URL (which here I
am creating from items in a form, in the case of someone NOT using the
submit button!) And then reloading the page.
NewURL = "location.asp?";
var EleNum = 0;
var EleNumMx = document.plform.elements.length;
do {
if (document.plform[EleNum].type == "select-one") {
if (document.plform[EleNum].selectedIndex != 0) {
NewURL += document.plform[EleNum].name + "=" +
document.plform[EleNum].value + "&";
}
}
if(document.plform[EleNum].type == "text") {
if (document.plform[EleNum].value != 0 ) {
NewURL += document.plform[EleNum].name + "=" +
document.plform[EleNum].value + "&";
}
}
if(document.plform[EleNum].type == "textarea") {
if (document.plform[EleNum].value != 0 ) {
NewURL += document.plform[EleNum].name + "=" +
document.plform[EleNum].value + "&";
}
}
} while(++EleNum < EleNumMx);
window.location=NewURL;
Hope this helps
John Dobson
"AlwaysLearning" <ru****@nwlink.com> wrote in message
news:tM*****************@rwcrnsc52.ops.asp.att.net ...
I don't think it is possible, because the vbscript (the server code) will
always be executed before the page ever reaches the browser where the
javascript is executed. Please correct me if I am wrong. I wish someone
would post a website or write a book on the subject of communication
between server-side and client-side scripts.
Phil
"Jonas Daunoravicius" <Jd************@questarcapital.com> wrote in message
news:fa*************************@posting.google.co m... The subject pretty much sums up what I need to do. Here is what I
have so far, but still can't figure out how to get it working:
<script language="javascript" type="text/javascript">
function fillForm()
{
// split the query string into pieces
var qs = location.search.substr(location.search.indexOf("?" )+1);
qs = qs.split("&");
alert(qs); // qs is the variable that I need to pass into a
// vbscript var. This actually works up to here.
'<%the_name%>' = qs // this line does not work, but is what I need
// to do.
}
</script>
later in the code:
<%
Response.write ("<script>fillForm();</script>")
Response.write("This is the variable: " & the_name)
%>
On the page it obviously comes up as "This is the variable: " and that
is it...blank for the_name.
I need to use javascript to get the variables out of the url, such as:
http://www.x.com/test.asp?Dell%20Computer%20Corp
qs will then end up being "Dell Computer Corp" and I need to make a
vbscript variable to also be that so I can query/load/etc certain
stuff in asp to display on the site.
Thanks for your help!
- Jonas