Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Go directly to desired page, in JavaScript

3 views
Skip to first unread message

Bert Visscher

unread,
Aug 10, 2004, 4:25:18 AM8/10/04
to
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.

unread,
Aug 10, 2004, 5:04:25 AM8/10/04
to
Bert Visscher wrote on 10 aug 2004 in comp.lang.javascript:
> 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

unread,
Aug 10, 2004, 5:30:48 AM8/10/04
to
On Tue, 10 Aug 2004 10:25:18 +0200, Bert Visscher wrote:

> 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

0 new messages