View Full Version : Pass JS Argument as part of the URL?
If I have an HTML with a script in it and that script takes an argument, can I pass the needed argument as part of the URL that leads to that page?
Also if it IS possible, how can I have said script deal with NOT recieving said argument?
Thanks.
Don
whammy
10-23-2002, 01:36 AM
http://www.javascriptkit.com/javatutors/send1.shtml
:)
Whammy:
Thanks for the reply.
What I'm trying to accomplish is to make it so that when someone goes to one of the pages on my site which are intended to be used in the main frame (a frames site), the user will be redirected to my frames page (the one containing the frame sets etc) while passing the filename as an argument. The script is supposed to display the frames with the requested page shown in the main frame.
I've got my individual pages set to detect whether they are loaded in the frame or loaded by themselves. If one is loaded by itself, it changes to the index.html file (the frames page) passing the requested filename as the argument.
When the frames page attempts to load, it gets stuck in an endless loop. Can someone assist in figuring out why.
Thanks.
P.S. in case the code can't be seen because it's html, I'm attaching it as a txt file.
<html>
<head>
<Title>Don Ireland</title>
<baseref "http://mywebpages.comcast.net/doni49/">
</head>
<script language="JavaScript" src="JavaScript/NoRightClick.js"></script>
<script>
function getFromSearch() {
mySearch = location.search.substr(1).split("&")
if (mySearch == "none")
return (mySearch)
else return ("home")
}
function initForm() {
location.href(getFromSearch() + ".html")
}
</script>
<body onLoad="initForm()">
</body>
document.write(
"<frameset rows='75,*,25' border='0'>
<frame src='top.html' name='top' marginwidth='0' marginheight='0' scrolling='no' noresize>
<frameset cols='200,*,10' border='0'>
<frame src='navigation.html' name='navigation' marginwidth='5' marginheight='0' scrolling='auto' noresize>
<frame src= getFromSource() + '.html' name='main' marginwidth='0' marginheight='0' scrolling='auto' noresize>
<frame src='RightSide.html' name='RightSide' marginwidth='0' marginheight='0' scrolling='auto' noresize>
</frameset>
<frame src='bottom.html' name='bottom' marginwidth='0' marginheight='0' scrolling='no' noresize>
<noframes>
<h4> Your Browser Doesn't Support Frames.</h4>
</noframes>
</frameset>"
</html>
beetle
10-23-2002, 05:48 AM
I did a script like that once using cookies (http://www.peterbailey.net/js/superframes.js)
If I remember correctly, I modified it once to work with the search-string in 5mins or so. Don't have a saved copy of that though...
joh6nn
10-23-2002, 06:12 AM
http://codingforums.com/ubb/Forum4/HTML/009362.html
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.