Click to See Complete Forum and Search --> : Need help with my scripts with frame


cojo
03-20-2003, 12:23 PM
Here are my scripts:

index.html
----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<HTML><HEAD>
<TITLE>Welcome To Cojo-online.com</TITLE></HEAD>
<FRAMESET border=0 framespacing=0 frameBorder=no cols=200,*>
<FRAME name=menu src="left.html" noResize scrolling=no>
<FRAME name=body src="http://www.cojo-online.com" noResize scrolling=yes>
</FRAMESET></HTML>

left.html
-----
<!DOCTYPE HTML PUBLIC>
<HTML><HEAD><TITLE>left.html</TITLE>
<SCRIPT LANGUAGE=javascript type=text/javascript?
var count=1;
succeding
var link_aray = new Array();
link_array[1] = 'index.html';
link_array[2] = 'london.html';
link_array[3] = 'paris.html';
link_array[4] = 'ski.html';
link_array[5] = 'santo.html';
link_array[6] = 'kona.html';
link_array[7] = 'alaska.html';
link_array[8] = 'cancun.html';
link_array[9] = 'pdc.html';
link_array[10] = 'vegas.html';
link_array[11] = 'bahamas.html';
link_array[12] = 'seadoo.html';
link_array[13] = 'family.html';
link_array[14] = 'links.html';

function next()
{
if ((count+1) >= link_array.length)
{
alert('That was the last page');
}
else
{
count = count+1;
parent.frames['body'].document.location.href=link_array[count];
}
}

function previous()
{
if ((count-1) <= 0)
{
alert('This is the first page');
}
else
{
count=count-1;
parent.frames['body'].document.location.href=link_array[count];
}
}

function goToindex() { parent.frames['body'].document.location.href = "http://www.cojo-online.com"; }
function goTolondon() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/london.html"; }
function goToparis() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/paris.html"; }
function goToski() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/ski.html"; }
function goTosanto() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/santo.html"; }
function goTokona() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/kona.html"; }
function goToalaska() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/alaska.html"; }
function goTocancun() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/cancun.html"; }
function goTopdc() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/pdc.html"; }
function goTovegas() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/vegas.html"; }
function goTobahamas() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/bahamas.html"; }
function goToseadoo() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/seadoo.html"; }
function goTofamily() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/family.html"; }
function goTolinks() { parent.frames['body'].document.location.href = "http://www.cojo-online.com/links.html"; }

</SCRIPT>
</HEAD>
<BODY bgcolor=#ffffff><BR>
<CENTER><INPUT onclick=previous(); type=button value=Previous>
<INPUT onclick=next(); type=button value=Next></CENTER>
<!--INPUT onclick=parent.location.href="http://www.google.com" type=button value=Index>
<CENTER><INPUT onclick=goToindex(); type=button value=Index></CENTER>
<CENTER><INPUT onclick=goTolondon(); type=button value=London></CENTER>
<CENTER><INPUT onclick=goToparis(); type=button value=Paris></CENTER>
<CENTER><INPUT onclick=goToski(); type=button value=Ski Trips></CENTER>
<CENTER><INPUT onclick=goTosanto(); type=button value=Santo Dominco></CENTER>
<CENTER><INPUT onclick=goTokona(); type=button value=Kona, Hawaii></CENTER>
<CENTER><INPUT onclick=goToalaska(); type=button value=Alaska></CENTER>
<CENTER><INPUT onclick=goTocancun(); type=button value=Cancun></CENTER>
<CENTER><INPUT onclick=goTopdc(); type=button value=Playa De Carmen></CENTER>
<CENTER><INPUT onclick=goTovegas(); type=button value=Las Vegas></CENTER>
<CENTER><INPUT onclick=goTobahamas(); type=button value=Bahamas></CENTER>
<CENTER><INPUT onclick=goToseadoo(); type=button value=Seadoo></CENTER>
<CENTER><INPUT onclick=goTofamily(); type=button value=Family></CENTER>
<CENTER><INPUT onclick=goTolinks(); type=button value=Links></CENTER>
<CENTER><INPUT onclick="parent.location='mailto:sept771@yahoo.com'" type="button" value="Email Me">

The "Email Me" part work and that is it. The rest of the button just give me an "Error on Page".....Could someone tell me what I did wrong?????thanks.....John

requestcode
03-20-2003, 12:34 PM
You should not use "body" as a frame name. That could be causing your problem. Try changing the name to something else and see if that corrects your problem. You could also combine all of those functions into one by passing the link to load into the frame to the function. For example:
function goTolinks(linkid) { parent.frames['bodyframe'].document.location.href = linkid; }

><INPUT onclick=goTolinks('http://www.cojo-online.com/links.html'); type=button value=Links>

Jona
03-20-2003, 12:43 PM
This works for the next() function:

<html><head>
<script>
var count=1;
var l_ary=new Array("index.html","london.html","paris.html","ski.html","santo.html","kona.html","alaska.html","cancun.html","pdc.html","vegas.html","bahamas.html","seadoo.html","family.html","links.html");

alert(l_ary[0])
function next(){
if ((count+1) >= l_ary.length){ alert('That was the last page'); } else {count = count+1;
alert(l_ary[count]);
} }
</script>
</head><body>
<input type=button onclick="next()" value="Next">
</body></html>

cojo
03-20-2003, 12:50 PM
ok thanks...I will give it a try. I'll let you know the outcome....Thanks...again

cojo
03-20-2003, 02:07 PM
requestcode, I tried your instructions and still getting the same error. When I click on the button nothing happen except "Error on Page" at the bottom of the browser. Anymore suggestions???? Anyone???

Jona
03-20-2003, 02:17 PM
Try putting quotes around everything in your buttons:

<INPUT onclick="goToindex();" type="button" value="Index">

Other than that, I say try this:

function goToindex() { parent.frameName.location = "http://www.cojo-online.com"; }

That should work. document.location doesn't work. It is either window.location or location.

cojo
03-20-2003, 02:44 PM
Jona, I tried both way and neither way work. Let me tell what I'm trying to do and maybe you know an easier way to do this. I'm trying to build my website with left and right frames. When I click on the button on the left frame. I want the website to be open on the right frame without openning up a new window. I could get it to open with a new window. What do you think?

Jona
03-20-2003, 02:49 PM
Are you sure that something as simple as this:

<a href="parent.frameName.location='somewhere.com'">Somewhere.com in right frame</a>

..doesn't work?

cojo
03-20-2003, 02:54 PM
Jona, sorry....I must look at my code too long and didn't see the missing end > at the beginning of my code. I added to my code and changed what you said and it work now. Thanks for all you help. I'm sure I will be back for more question......:D

Jona
03-20-2003, 02:57 PM
Don't you just love those simple mistakes?

I'm sure I will be back for more question......

That's cool.... But take your time... :D