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. 7 1429
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)
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
Dag Evertjan,
The way I interpret your reply, the following code should work:
<html>
<frameset rows="88,*">
<frame name="kop" noresize src="kop.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[0]=="gezondheidslijn") { document.write ("<frame name='body'
src='pi-gezondheidslijn.htm' />") }
else { document.write ("<frame name='body' src='hoofdpagina.htm' />") }
</script>
</frameset>
</frameset>
</html>
I'm afraid it doesn't. Just like before, I see the top and left frame
appear, but there's no body.
TIA and regards, Bert V.
"Evertjan." <ex**************@interxnl.net> schreef in bericht
news:Xn********************@194.109.133.29... 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)
Bert Visscher wrote on 10 aug 2004 in comp.lang.javascript : "Evertjan." <ex**************@interxnl.net> schreef in bericht news:Xn********************@194.109.133.29... 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") { The way I interpret your reply, the following code should work:
<html> <frameset rows="88,*"> <frame name="kop" noresize src="kop.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[0]=="gezondheidslijn") { document.write ("<frame name='body' src='pi-gezondheidslijn.htm' />") } else { document.write ("<frame name='body' src='hoofdpagina.htm' />") } </script> </frameset> </frameset> </html>
I'm afraid it doesn't. Just like before, I see the top and left frame appear, but there's no body.
This
= if (prog[0]=="gezondheidslijn") =
would require zoiets als: http://mySite.nl/test.html?gezondheidslijn&y=blah
This cannot be the output of a <form>
Do you get javascript errors ?
Please start debugging by inserting a handful of alert()s:
<frame name='body'
<script type="text/JavaScript"> // the 'language=' is depriciated
var prog = location.search
alert(prog) // is there a & in the string ???
prog = prog.substr(1)
alert(prog) // do you see the same without the '?' ?
prog = prog.split("&")
alert(prog[0]) // do you see 'gezondheidslijn' ?
if (prog[0]=="gezondheidslijn"){
alert('ja') // 'if' is given true
document.write("src='pi-gezondheidslijn.htm'")
}
else {
alert('nee') // false
document.write("src='hoofdpagina.htm'")
}
</script>
/>
Are the two links correct ?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
"Evertjan." <ex**************@interxnl.net> schreef in bericht
news:Xn********************@194.109.133.29... Bert Visscher wrote on 10 aug 2004 in comp.lang.javascript: "Evertjan." <ex**************@interxnl.net> schreef in bericht news:Xn********************@194.109.133.29... 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") { The way I interpret your reply, the following code should work:
<html> <frameset rows="88,*"> <frame name="kop" noresize src="kop.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[0]=="gezondheidslijn") { document.write ("<frame name='body' src='pi-gezondheidslijn.htm' />") } else { document.write ("<frame name='body' src='hoofdpagina.htm' />") } </script> </frameset> </frameset> </html>
I'm afraid it doesn't. Just like before, I see the top and left frame appear, but there's no body.
This = if (prog[0]=="gezondheidslijn") = would require zoiets als: http://mySite.nl/test.html?gezondheidslijn&y=blah This cannot be the output of a <form>
Do you get javascript errors ?
Please start debugging by inserting a handful of alert()s:
<frame name='body' <script type="text/JavaScript"> // the 'language=' is depriciated var prog = location.search alert(prog) // is there a & in the string ??? prog = prog.substr(1) alert(prog) // do you see the same without the '?' ? prog = prog.split("&") alert(prog[0]) // do you see 'gezondheidslijn' ? if (prog[0]=="gezondheidslijn"){ alert('ja') // 'if' is given true document.write("src='pi-gezondheidslijn.htm'") } else { alert('nee') // false document.write("src='hoofdpagina.htm'") } </script> />
Are the two links correct ?
Hoi Evertjan,
I flipped a couple of quotes, and ended up with the following complete code:
<html>
<frameset rows="88,*">
<frame name="kop" noresize src="kop.htm" />
<frameset cols="152,*">
<frame name="menu" noresize src="menu.htm" />
<frame name="body"
<script type="text/JavaScript">
var prog = location.search
alert(prog) // is there a & in the string ???
prog = prog.substr(1)
alert(prog) // do you see the same without the '?' ?
prog = prog.split("&")
alert(prog[0]) // do you see 'gezondheidslijn' ?
if (prog[0]=="gezondheidslijn")
{
alert("ja") // 'if' is given true
document.write('src="pi-gezondheidslijn.htm"')
}
else
{
alert("nee") // false
document.write('src="hoofdpagina.htm"')
}
</script>
/>
</frameset>
</frameset>
</html>
I think we're getting closer:
This time around, regardless of whether I add "?gezondheidslijn", I get a
body...but it stays blank. And, as if that's not curious enough, I'm not
getting any of the alerts.
Oh, I nearly forgot to write that I'm not getting any error messages.
TIA and regards, Bert V.
Bert Visscher wrote on 12 aug 2004 in comp.lang.javascript : I think we're getting closer: This time around, regardless of whether I add "?gezondheidslijn", I get a body...but it stays blank. And, as if that's not curious enough, I'm not getting any of the alerts.
Oh, I nearly forgot to write that I'm not getting any error messages.
Tja, Bert, dan wordt de hele script niet uitgevoerd in een frame
declaratie!!!
Dit werkt wel:
<html>
<script type="text/JavaScript">
function kies(x){
myBody.location.href=
(location.search.substr(1).split("&")[0]==
"gezondheidslijn")
?"pi-gezondheidslijn.htm":"hoofdpagina.htm"
}
</script>
<frameset rows="88,*" onLoad="kies()">
<frame name="kop" noresize src="kop.htm" />
<frameset cols="152,*">
<frame name="menu" noresize src="menu.htm" />
<frame name="myBody" />
</frameset>
</frameset>
</html>
[ik heb de code sterk verkort en de naam "body" vervangen,
omdat dat soms een "reserved word" zou kunnen zijn.]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
> I think we're getting closer: This time around, regardless of whether I add "?gezondheidslijn", I get a body...but it stays blank. And, as if that's not curious enough, I'm not getting any of the alerts.
Oh, I nearly forgot to write that I'm not getting any error messages.
TIA and regards, Bert V.
I had a similar problem. I got it to work with iframes using the
following:
<script language="JavaScript">
page = "main.htm"; //default page
if(location.search) page = location.search.substring(1);
//insert extra logic here if want
document.write('<iframe src="' + page + '" id="myIframe"
name="myIframe" width="630" scrolling="no"
frameborder="1"></iframe>');
</script>
You could add logic in there, like:
if (page = "help") page = help.html;
I hope this helps.
Jim This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Laphan |
last post by:
Hi All
I've been looking at having my Javascript file as an ASP one to try and stop
general prying eyes, eg:
<SCRIPT LANGUAGE="javascript" SRC="js-something.asp">
</SCRIPT>
and this seems...
|
by: Wladimir Borsov |
last post by:
I want to mark certain text on a web page in InternetExplorer and then copy and
paste it into a normal text editor.
With the copied text not only the pure text should be transferred but also the...
|
by: David |
last post by:
Ok. Can PHP control a form value directly? Eg. like the javascript
"document.Form1.text01.value = "Y"". Eg. allow me to put a value into
a form text field on page load. Either I missed this in...
|
by: AP No spam |
last post by:
Hi
I need help to Print Pdf File directly
without preview from client side
To solve problem I used
This C# code
Response.Buffer = true;
|
by: Dica |
last post by:
i've got a dropdown list with various options added to it. i want to add a
button that allows the user to "Add New Option' which should create a blank
row on the dropdown list and allow the user to...
|
by: Tim Walters |
last post by:
My web page was put together by the Spanish yellow pages company (closely
associated with -- but don't ask me how -- with the ISP Telefonica). I can
access the page by going to the yellow pages...
|
by: Neo Geshel |
last post by:
I am seeking a method to load one JS file directly into another,
*without* having to dynamically write <scripttags.
Is there any method whereby I can call only one external JS file using a ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |