By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,629 Members | 1,703 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,629 IT Pros & Developers. It's quick & easy.

Can't Pass Query String

P: n/a
Hi,

Below is a stock script I found which controls a framed environment.
My problem is that if a URL has a query string attached, that string
does not pass through. Can someone please let me know if and
hopefully how, it will be possible to carry a query string through?

This first part here is in the default.asp framed page.

<SCRIPT LANGUAGE="JavaScript">
<!--

var ar0 = "top.asp";
var ar1 = "side.asp";
var ar2 = "welcome.asp";

var str = location.search;
var pos = str.indexOf("&");
if (pos != -1) {
var num = str.substring(pos + 1, str.length);
window["ar" + num] = str.substring(1, pos);
}

// -->
</SCRIPT>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

document.write(
'<frameset framespacing="0" border="0" frameborder="0" rows="152,*">',
'<frame name="toprow" scrolling="no" noresize target="maincontent" src="',
ar0, '" marginwidth="0" marginheight="0">',
'<frameset cols="181, *">',
'<frame name="leftcolumn" target="maincontent" src="', ar1, '"
marginwidth="0" marginheight="0" scrolling="auto" noresize>',
'<frame name="maincontent" src="', ar2, '" marginwidth="0"
marginheight="0" scrolling="auto">',
'</FRAMESET>',
'</FRAMESET>'
);

// -->
</SCRIPT>

Then for any page to appear in the frames
this script is used in that page. But if that
page is called with a query string attached
that string will not pass through without
adjustments that I do not know how to
deal with in either page.

<SCRIPT LANGUAGE="JavaScript">
<!--
var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

if (top.location.href.indexOf("default.asp") == -1)
top.location.href = "default.asp?" + sPage + "&2";
// -->
</SCRIPT>

Help would be greatly appreciated,
Fox
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Tue, 29 Mar 2005 18:21:32 GMT, in comp.lang.javascript
"news-server.tampabay.rr.com" <fox @ connexions.net> wrote:
| Hi,
|
| Below is a stock script I found which controls a framed environment.
| My problem is that if a URL has a query string attached, that string
| does not pass through. Can someone please let me know if and
| hopefully how, it will be possible to carry a query string through?
|
| This first part here is in the default.asp framed page.
|
| <SCRIPT LANGUAGE="JavaScript">
| <!--
|
| var ar0 = "top.asp";
| var ar1 = "side.asp";
| var ar2 = "welcome.asp";


Try adding:
var ar2 = "welcome.asp?<%Request.QueryString)";

[snip 2 end]
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #2

P: n/a
"Jeff North" <jn******@yahoo.com.au> wrote in message
news:3a********************************@4ax.com...
Try adding:
var ar2 = "welcome.asp?<%Request.QueryString)";


[snip]

Don't you mean:

var ar2 = "welcome.asp?<%=Request.QueryString()%>";
Jul 23 '05 #3

P: n/a
Fox

"McKirahan" <Ne**@McKirahan.com> wrote in message
news:Y4********************@comcast.com...
"Jeff North" <jn******@yahoo.com.au> wrote in message
news:3a********************************@4ax.com...
Try adding:
var ar2 = "welcome.asp?<%Request.QueryString)";


[snip]

Don't you mean:

var ar2 = "welcome.asp?<%=Request.QueryString()%>";


I see I did not explain well enough. Thanks, that one
does work, but that is not where my problem is.

My problem is when calling an orphan page with
a URL and query. That orphan page will show up
in the frames as it is supposed to as a child, but the
query is no more.

I need to be able to carry the query from the orphan
to the parent, so that the orphan, when a child,
still has the query value available within it.
This is the script in the orphan pages which makes
them becomes children of the frames when accessed.
When I access them with a query I need that query
to get written into the Javascript so that it can then
become a variable in the parent frame page (default.asp)
I have tried many things and read many web pages but
cannot seem to get the relationship and syntax needed.

<SCRIPT LANGUAGE="JavaScript">
<!--
var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

if (top.location.href.indexOf("default.asp") == -1)
top.location.href = "default.asp?" + sPage + "&2";
// -->
</SCRIPT>

Here again is the script in the framed page, which
needs to read and use the Query String in the
third frame or as it is in the script AR2.

<SCRIPT LANGUAGE="JavaScript">
<!--

var ar0 = "top.asp";
var ar1 = "side.asp";
var ar2 = "welcome.asp";

var str = location.search;
var pos = str.indexOf("&");
if (pos != -1) {
var num = str.substring(pos + 1, str.length);
window["ar" + num] = str.substring(1, pos);
}

// -->
</SCRIPT>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

document.write(
'<frameset framespacing="0" border="0" frameborder="0" rows="152,*">',
'<frame name="toprow" scrolling="no" noresize target="maincontent" src="',
ar0, '" marginwidth="0" marginheight="0">',
'<frameset cols="181, *">',
'<frame name="leftcolumn" target="maincontent" src="', ar1, '"
marginwidth="0" marginheight="0" scrolling="auto" noresize>',
'<frame name="maincontent" src="', ar2, '" marginwidth="0"
marginheight="0" scrolling="auto">',
'</FRAMESET>',
'</FRAMESET>'
);

// -->
</SCRIPT>

If you can still help me it would be greatly
appreciated. I built alot around this and
am sort of stuck having to solve it.

Regards,
Fox
Jul 23 '05 #4

P: n/a
On Wed, 30 Mar 2005 04:54:21 -0600, in comp.lang.javascript
"McKirahan" <Ne**@McKirahan.com> wrote:
| "Jeff North" <jn******@yahoo.com.au> wrote in message
| news:3a********************************@4ax.com...
|
| > Try adding:
| > var ar2 = "welcome.asp?<%Request.QueryString)";
|
| [snip]
|
| Don't you mean:
|
| var ar2 = "welcome.asp?<%=Request.QueryString()%>";

Yeah that too :-)

---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.