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