Forum Moderators: open

Message Too Old, No Replies

i frames in an orphan page

         

stefanoe

3:08 pm on Oct 5, 2003 (gmt 0)

10+ Year Member



hi,

when google finds my page it's an orphan,and i'm searching for an javascript that put's the orphan page into my i- frame
any suggestions? <snip> = the site

[edited by: engine at 4:39 pm (utc) on Oct. 5, 2003]
[edit reason] No urls, thanks. See TOS [webmasterworld.com] [/edit]

tedster

7:40 pm on Oct 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, stefanoe.

Have a look at message #21 in our Generic Javascript [webmasterworld.com] thread. It gives an approach to handling orphans from regular framesets - but that approach can easily be adapted to an iframe situation.

[edited by: tedster at 7:39 pm (utc) on Nov. 19, 2003]

stefanoe

2:55 pm on Oct 6, 2003 (gmt 0)

10+ Year Member



well,that the problem srry i asked my question wrong i don't know what to change i changed many things on that script but seems not to work i do'nt get javascript realy,.... i foudn it hard so i copy and copy and yes i copy all my javascripts from the web but now i have an light difference and then i'm lost i think i'm going to d/l some nice javascript tutorial but for now could you say what to change on this code?

THE CODE
Call this javascript code from the HEAD section of each child page. The code creates a variable from the URL of the page, and then passes that variable in the new location's URL. This means a "master" frameset can load this exact page in the content section:

passpage = document.URL
if (top.location == self.location)
top.location.href="master.html?" + passpage

Then create just one "master.html" page. It holds the JavaScript code to decipher whatever URL is passed after the "?" and it writes that page into the content frame:

<html>
<head>
<title>Master Frameset</title>
</head>

<script language="JavaScript" type="text/javascript">

origURL = parent.document.URL
contentURL = origURL.substring(origURL.indexOf('?')+1, origURL.length)

document.write('<frameset cols="20%,80%"><frame src="leftnav.html" name="nav"><frame src="' + contentURL + '" name="content"><\/frameset>')

</script>

</html>

btw (i'm not english so i do'nt know how to write this excatly but i'll give it a try) LOVLY FORUM YOU HAVE GOT HERE!

tedster

3:56 pm on Oct 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the last line of javascript, the one the begins "document.write" is where you need to make a change. It's actually writing lines of HTML into your document, and the way it's set up it's writing a frameset document.

So you need the script to write your iframe element instead, and in the exact spot in your HTML document where you want the iframe code to appear.

The parts of the script inside the parenthesis and between the single quotes are exact text that gets written. The + contentURL + is a variable that you've defined a few lines earlier -- that's the part that writes in the url of the document that was passed. It will stand for something different depending on which orphaned page is activating the script.

document.write('<iframe src="'+ contentURL + 'width="200" height="150" title="your title"></iframe>')

[edited by: tedster at 11:10 pm (utc) on Nov. 19, 2003]

stefanoe

7:44 pm on Oct 6, 2003 (gmt 0)

10+ Year Member



srry,but it doesn't work what m i doing wrong?

look @ <snip> then it redirects but i can't change the with and the height very wird and nothing loads :(
tip the i frame is on the botton and i use home.index3.html as my master.

[edited by: korkus2000 at 1:24 pm (utc) on Oct. 18, 2003]