473,240 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,240 software developers and data experts.

passing url var from a frameset using document.write

I need help to modify the code below to pass url variables from a
framset. The click to run this will be in the mainFrame.

This script works well in a non-frame page. Grabs the current url
variables and adds them to my url.

<script type="text/javascript">
//<![CDATA[
document.write('<a href="my_url.cfm?actionID=close&' +
location.search.substring(1) + '"><img src="launch.jpg" width="75"
height="30" border="0"></a>');
//]]>
</script>
Thanks in advance.
Jul 23 '05 #1
7 8947
Scott wrote:
I need help to modify the code below to pass url variables from a
framset. The click to run this will be in the mainFrame.

This script works well in a non-frame page. Grabs the current url
variables and adds them to my url.

<script type="text/javascript">
document.write('<a href="my_url.cfm?actionID=close&' +
location.search.substring(1) + '"><img src="launch.jpg" width="75"
height="30" border="0"></a>');
</script>


Can you take care of it using one of these approaches:

http://www.mcfedries.com/JavaScript/reframer.asp

if (location.search)
frameSRC = location.search.substring(1);
else
frameSRC = "Put the name of the default frame page here";

http://p2p.wrox.com/archive/beginnin.../2002-03/0.asp

(location.search ? location.search.substring(1):'default.htm') + '">');
similar:
http://www.cybercoded.com/articles/a013_1.asp
http://tech.irt.org/articles/js013/

Mike

Jul 23 '05 #2

Thanks for the reply. Unforutnately I can only use javascript to obtain
the url var from the frameset and pass it along to a coldfusion page. I
am working on a server with alot of restrictions, so it is javascript or
bust.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

Just realized that I spoke too soon. (sorry late night), the links you
sent were to js not asp. please accept my apology. I will check those
out now and report back.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #4
scott wrote:
Just realized that I spoke too soon. (sorry late night), the links you
sent were to js not asp.


Maybe see if you can work with one of these if those don't work out for you:

top.location.href
window.location.href

alert('top.location.href\n'+top.location.href+'\nw indow.location.href\n'+window.location.href);

Good Luck,
Mike

Jul 23 '05 #5
Mike, thanks again for the help. I am very shaky with js.

I reviewed those links, and I think I should clarify my problem a bit
more. It appears those links explain how to work with js to either
pass or pull data so that js can render the framesets for you.
I need to use js to read the url variables from a frameset page. I am
very average with js, but I think my solution would be something like
adding to the script to let it know I was working in a frameset.
How would I grab everything after the questionmark in the following
url from a frameset and append it to a link.

So that this
foo.com?var1=1234&var2=5678

Gets me this
myUrl.com?var1=1234&var2=5678

Thanks again!!
Jul 23 '05 #6
Scott wrote:
<snip>
I need to use js to read the url variables from a frameset page. >
How would I grab everything after the questionmark in the following
url from a frameset and append it to a link.

So that this
foo.com?var1=1234&var2=5678

Gets me this
myUrl.com?var1=1234&var2=5678


Sorry I wasn't clearer in my last message, see if this will work for
you. It takes advantage of "top" which will jump you directly to the top
of the frame tree, so you can do a location.search on the top window
from any frame, this worked in my IE6, Netscape7, Firefox 0.8.

function show() {
alert('top.location.search ' + top.location.search);
alert('top.window.location.search '+top.window.location.search);
alert('top.window.location.search.substring(1)
'+top.window.location.search.substring(1));
}

To read about using "top":

http://www.quirksmode.org/js/frameintro.html
http://www.yourhtmlsource.com/javasc...ingframes.html

Good Luck,
Mike

Jul 23 '05 #7
Scott wrote:
I need help to modify the code below to pass url variables from a
framset. The click to run this will be in the mainFrame.

This script works well in a non-frame page. Grabs the current url
variables and adds them to my url.

<script type="text/javascript">
//<![CDATA[
document.write('<a href="my_url.cfm?actionID=close&' +
location.search.substring(1) + '"><img src="launch.jpg" width="75"
height="30" border="0"></a>');
//]]>
</script>

Thanks in advance.


The frames in a frameset have no access to any information passed on
the URI, because they are defined as:

<frame src="somepage.html" ... />

Even if the frameset file containing the above HTML was passed items
on the URI, somepage.html will have no access to that information
because it is being requested without them. If you what you want is
somepage.html to have access to information passed to the frameset
containing it, then use:

frameset.html ---

html>
<head>
</head>
<script type="text/javascript">
var query = window.location.search.substring(1);
if (query != '') {
query = '&' + query;
}
document.write(
'<frameset rows="86,*" border="0">' +
'<frame name="top_frame" src="top.html?page=top' +
query +
'" noresize="noresize" scrolling="no" marginheight="0"
marginwidth="0" />\r\n' +
'<frame name="body_frame" src="body.html?page=body' +
query +
'" noresize="noresize" marginheight="0" marginwidth="0" />' +
'</frameset>'
);
</script>
</html>

top.html and body.html ---

<html>
<head>
</head>
<body onload="alert(window.location.search);">
</body>
</html>
Load frameset.html?x=y and you should see that passed to both top.html
and body.html.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Dthmtlgod | last post by:
I am having a little difficulty in passing a value from a page to another page. I am going to provide excerpts from the code. I think I am close. This is from Page1.ASP <% Set Conn =...
1
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML...
2
by: dan | last post by:
Hello - I'm working on a page that will deliver a frameset under certain conditions and delivers a normal page under other conditions. I would like to avoid using a redirect so that the URL...
14
by: Alex Molochnikov | last post by:
Is there any way to embed the HTML code inside FRAMESET? Something like this: <frameset cols="50%,*"> <frame src=" ... HTML code for the frame ... "> <frame src="Frame2.html" name="main">...
1
by: | last post by:
Hi, 1st, I did a search and could not find any info on this, the Google results were good, but I'm still have issues...So any help will be great. I have a frame page, which contains 3 frames...
2
by: Mark | last post by:
Hello. I am working on a common problem. . .restoring frameset context when a user links directly to a page. Loading the frameset isn't a problem. . .there are numerous examples of simple...
2
by: BrendanMcPherson | last post by:
Hello Im trying to make this application that does this. The user enters text in a window clicks GO and then a new window opens with the text in a frame. I assume I put the text in the URL....
3
by: radsat | last post by:
Hi I have a html page, which has some sites, when the user clicks on the site, <tr><td><a href="us.html" onclick = "setSiteCode('US')">USA</a></td></tr> and the javascript is, var siteCode...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.