Discussion:
Go directly to desired page, in JavaScript
(too old to reply)
Bert Visscher
2004-08-10 08:25:18 UTC
Permalink
Hello everyone,

I would like to let visitors of my website be able to go directly to a
desired page, by using a URL like www.example.com?progname. I thought I
could do this as follows:

<html>
<frameset rows="88,*">
<frame name="head" noresize src="head.htm" />
<frameset cols="152,*">
<frame name="menu" noresize src="menu.htm" />
<script language="JavaScript">
prog = location.search
prog = prog.substr(1)
prog = prog.split("&")
if (prog=="progname") { document.write ("<frame name='body' noresize
src='progpage.htm' />") }
else if (prog==...
...
else { document.write ('<frame name="body" noresize src="mainpage.htm"
/>') }
</script>
</frameset>
</frameset>
</html>

I see that the above code doesn't produce a page for the body, but I can't
see why? Could anybody please tell me what I'm overlooking?

TIA and regards, Bert Visscher.
Evertjan.
2004-08-10 09:04:25 UTC
Permalink
Post by Bert Visscher
prog = prog.split("&")
if (prog=="progname") {
[follow up to: comp.lang.javascript]

Dag Bert,

prog is not a string but an array.
If the calling url was:

http://mySite.nl/test.html?x=progname&y=blah

if (prog[0] == "x=progname") {
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Andrew Thompson
2004-08-10 09:30:48 UTC
Permalink
I would like to let visitors of my website..
URL?

BTW ... alive.internet.lang.javascript,
(never heard of it..)
alt.comp.lang.javascript,
(what a load of crap..)
comp.lang.java.javascript,
(not an official group..)
comp.lang.javascript
(Ahhhh.. yes, this is where the JS gurus reside)

Please do not cross-post to 4 separate groups..
You may think your problem is that important,
others know it is not.
<http://www.physci.org/codes/javafaq.jsp#xpost>

Follow ups for this thread set to c.l.js ONLY..

[ Please note that even to post *this* message to
four groups has my newsreader whining at me.. ]
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Loading...