From: beegee on 3 Dec 2009 09:16 On Dec 3, 4:36 am, "Fokke Nauta" <fnaut...(a)SPAMiae.nl> wrote: > "rf" <r...(a)z.invalid> wrote in message > > I still have a javascript which did this for a frameset. Somehow if you link > to this frameset like frameset.htm?first, it would load the frameset with > the page first.htm in one of the frames. I tried to convert this script to > use it with my current situation, bit it did not work. Well this is sort of interesting. If the URL was frameset.htm#first that would be an anchor. You could pick the anchor up in javascript on the framset page with something like: var anchor = self.document.location.hash Then you could do something like: var fileToLoad; switch(anchor) { case "first": fileToLoad = "first.htm"; break; case "second": etc. } var frameElem = docment.getElementById("myFrame"); frameElem.src = fileToLoad; Not sure of your level of programming so "etc." is not real javascript. Again, this is easier done with server side programming as others have pointed out. Also, it's better done not using iframes at all. Bob
From: Fokke Nauta on 6 Dec 2009 04:47 "beegee" <bgulian(a)gmail.com> wrote in message news:fe5fdf38-ad82-496b-a14e-116d8d90def7(a)p36g2000vbn.googlegroups.com... > On Dec 3, 4:36 am, "Fokke Nauta" <fnaut...(a)SPAMiae.nl> wrote: >> "rf" <r...(a)z.invalid> wrote in message >> > >> I still have a javascript which did this for a frameset. Somehow if you >> link >> to this frameset like frameset.htm?first, it would load the frameset with >> the page first.htm in one of the frames. I tried to convert this script >> to >> use it with my current situation, bit it did not work. > > > Well this is sort of interesting. If the URL was frameset.htm#first > that would be an anchor. You could pick the anchor up in javascript > on the framset page with something like: > > var anchor = self.document.location.hash > > Then you could do something like: > > var fileToLoad; > switch(anchor) > { > case "first": fileToLoad = "first.htm"; break; > case "second": etc. > } > > var frameElem = docment.getElementById("myFrame"); > frameElem.src = fileToLoad; > > > Not sure of your level of programming so "etc." is not real > javascript. Again, this is easier done with server side programming > as others have pointed out. Also, it's better done not using iframes > at all. > > Bob Hi Bob, Thanks. I will put the code I used with frames underneath this post. I have some programming experience in Basic and 4DOS batch commands and in Unix shell scripting. But I'm not deep into javascripts. I have no experience with server side programming. Is that .ASP pages? And what's wrong with I-frames? Rgs, Fokke --------------------------------------------------------- <script> ref = location.href; pageRE = /(\?|\&)page=(\w|,)*/; pageStr = ref.match(pageRE); page = "main"; if(pageStr != null) { // remove the (? or &)page= part of the string page = pageStr[0].substring(6, pageStr[0].length); // change all comma's back to slashes page.replace("/,/", "/\//"); } document.write("<frameset framespacing=\"0\" border=\"false\" frameborder=\"0\" rows=\"125,*\">"); document.write("<frame name=\"banner\" src=\"banner.htm\" scrolling=\"no\" >"); document.write("<frameset cols=\"163,*\">"); document.write("<frame name=\"contents\" src=\"content.htm\" target=\"main\" >"); document.write("<FRAME NAME=\"main\" SRC=\"" +page + ".htm\" scrolling=\"auto\" >"); document.write("</frameset><noframes><body><p>This page uses frames, but your browser doesn't support them.</p></body></noframes></frameset></html>"); </script>
First
|
Prev
|
Pages: 1 2 3 Prev: Floating X for closing a container Next: How to read the content of an object |