Solved

2 frames anf javascript

Posted on 1997-11-24
6
180 Views
Last Modified: 2008-02-26
Hello,

I have 2 frames and the following javaScript (animated buttons). The left frames has the animated buttons (alway the same frame) and should call the right frames.  When I click on the buttons (left) it loads the page unto the left frame unstead of the right ??

here is the script THANKS!:


<SCRIPT language="JavaScript">
<!--
var bn=navigator.appName;
var vn=navigator.appVersion;
var p1=null;
var p2=null;
var p3=null;
var p4=null;
var p5=null;
// Animated menu stuff
function off_img(loc,img) {};
function on_img(loc,img) {};

function gonow(p)
  {
  location=addr[p];
  };

var addr = new Array(5);
addr[1]="prokiad-intro.html";
addr[2]="selnas-index.html";
addr[3]="presse-index.html";
addr[4]="anglais-index.html";
addr[5]="commande-index.html";
menuimg = new Array(10);
if ((bn!="Microsoft Internet Explorer") || (vn.substring(0,3)!="2.0"))
{
menuimg[1]= new Image (90,53);
menuimg[1].src="prokiad-j-black.jpg";
menuimg[6]= new Image (90,53);
menuimg[6].src="prokiad-v-black.jpg";
menuimg[2]= new Image (90,53);
menuimg[2].src="méthode-j-black.jpg";
menuimg[7]= new Image (90,53);
menuimg[7].src="méthode-v-black.jpg";
menuimg[3]= new Image (90,53);
menuimg[3].src="presse-j-black.jpg";
menuimg[8]= new Image (90,53);
menuimg[8].src="presse-v-black.jpg";
menuimg[4]= new Image (90,53);
menuimg[4].src="anglais-j-black.jpg";
menuimg[9]= new Image (90,53);
menuimg[9].src="anglais-v-black.jpg";
menuimg[5]= new Image (90,53);
menuimg[5].src="commande-j-black.jpg";
menuimg[10]= new Image (90,53);
menuimg[10].src="commande-v-black.jpg";
}

function on_img(loc,img)
  {
  if ((bn!="Microsoft Internet Explorer") || (vn.substring(0,3)!="2.0"))
    loc.src=menuimg[img].src;
  }

// -->
</SCRIPT>
0
Comment
Question by:mickael
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
6 Comments
 
LVL 6

Accepted Solution

by:
tecbuilder earned 120 total points
ID: 1274777
In the function gonow change

function gonow(p) {
  location=addr[p];
}

to

function gonow(p) {
  framename.location=addr[p];
}

Where framename is the name of the frame you want the html file to be loaded into.

If you have any questions about this ask before grading?
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1274778
Oops.  I hit the submit button before I was done checking my answer.  The function gonow needs to be changed to

function gonow(p) {
  parent.framename.location=addr[p];
}

I left off the 'parent.' in my first part of the answer.
0
 

Author Comment

by:mickael
ID: 1274779

Hello,

I am getting a merror saying parent.framename has no properties

(this URL is the same stuff but    no Frames: http://www.adarweb.com/vs4/index.html)

Here is my entire left button frame HTML giving me the error:




<HTML>
<HEAD><TITLE>Selnas Buttons</TITLE><meta name="resource-type" content="document">


<SCRIPT language="JavaScript">
<!--
var bn=navigator.appName;
var vn=navigator.appVersion;
var p1=null;
var p2=null;
var p3=null;
var p4=null;
var p5=null;
// Animated menu stuff
function off_img(loc,img) {};
function on_img(loc,img) {};

function gonow(p)
  {
parent.framename.location=addr[p];

location=addr[p];
  };

var addr = new Array(5);
addr[1]="prokiad-intro.html";
addr[2]="selnas-index.html";
addr[3]="presse-index.html";
addr[4]="anglais-index.html";
addr[5]="commande-index.html";
menuimg = new Array(10);
if ((bn!="Microsoft Internet Explorer") || (vn.substring(0,3)!="2.0"))
{
menuimg[1]= new Image (90,53);
menuimg[1].src="prokiad-j-black.jpg";
menuimg[6]= new Image (90,53);
menuimg[6].src="prokiad-v-black.jpg";
menuimg[2]= new Image (90,53);
menuimg[2].src="méthode-j-black.jpg";
menuimg[7]= new Image (90,53);
menuimg[7].src="méthode-v-black.jpg";
menuimg[3]= new Image (90,53);
menuimg[3].src="presse-j-black.jpg";
menuimg[8]= new Image (90,53);
menuimg[8].src="presse-v-black.jpg";
menuimg[4]= new Image (90,53);
menuimg[4].src="anglais-j-black.jpg";
menuimg[9]= new Image (90,53);
menuimg[9].src="anglais-v-black.jpg";
menuimg[5]= new Image (90,53);
menuimg[5].src="commande-j-black.jpg";
menuimg[10]= new Image (90,53);
menuimg[10].src="commande-v-black.jpg";
}
function on_img(loc,img)
  {
  if ((bn!="Microsoft Internet Explorer") || (vn.substring(0,3)!="2.0"))
    loc.src=menuimg[img].src;
  }

// -->
</SCRIPT>



</HEAD>
<body background="../../images/gif/side-j.gif" bgcolor="#FFFFFF" vlink="#0000FF" TEXT="#000000" ALINK="#FF0000">




<table border=0>
<tr>
      <td>

<table border=0 valign="center">
<tr>
      
<td>

<a href="javascript:gonow(1) " target="left_window" onMouseOver="on_img(p1,6);self.status='Les laboratoires Prokiad';return true"onMouseOut= "on_img(p1,1);self.status='Les laboratoires Prokiad';return true">
<img src="prokiad-j-black.jpg" name="p1" alt="Les laboratoires Prokiad" border=0 width="90" height="53"></a>
      </td>

<tr>
      <td>
<a href="javascript:gonow(2)" onMouseOver="on_img(p2,7);self.status='La méthode S.E.L.N.A.S';return true"onMouseOut= "on_img(p2,2);self.status='La méthode S.E.L.N.A.S';return true">
<img src="méthode-j-black.jpg" name="p2" alt="la méthode S.E.L.N.A.S" border=0 width="90" height="53"></a>
      </td>
</tr>

<tr>
      <td>
<a href="javascript:gonow(3)" onMouseOver="on_img(p3,8);self.status='La presse et S.E.L.N.A.S';return true"onMouseOut= "on_img(p3,3);self.status='La presse et S.E.L.N.A.S';return true">
<img src="presse-j-black.jpg" name="p3" alt="La presse et S.E.L.N.A.S" border=0 width="90" height="53"></a>
      </td>
</tr>

<tr>
<td><a href="javascript:gonow(4)" onMouseOver="on_img(p4,9);self.status='Le site S.E.L.N.A.S en Anglais';return true"onMouseOut= "on_img(p4,4);self.status='Le site S.E.L.N.A.S en Anglais';return true">
<img src="anglais-j-black.jpg" name="p4" alt="Le site S.E.L.N.A.S en Anglais" border=0 width="90" height="53"></a>
      </td>
</tr>

<tr>
      <td>
<a href="javascript:gonow(5)" onMouseOver="on_img(p5,10);self.status='Commandez votre calenndrier ON LINE';return true"onMouseOut= "on_img(p5,5);self.status='Commandez votre calenndrier ON LINE';return true">
<img src="commande-j-black.jpg" name="p5" alt="Commandez votre calendrier ON LINE" border=0 width="90" height="53"></a>
      </td>
</tr>
</table>


      </td>

</tr>
</table>



</BODY>
</HTML>


0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 6

Expert Comment

by:tecbuilder
ID: 1274780
Oops!  It seems as though you used parent.framename.location=addr[p] exactly as I said.  Sorry, you misunderstood.  You need to change 'framename' to whatever your right frame name is called.  You may have called it 'right_frame'.  If so then you would use parent.right_frame.location=addr[p]

Let me know if this works.

I did find some things that need to be fixed:
line 89 - remove <TR>
line 185 - remove <TD>
line 195 - add </TR>

I would also suggest using an HTML validator program.  I found about 30 other minor errors.  You can find a validator at http://www.htmlvalidator.com .  It's shareware and you can use it 150 times before it disables itself.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1274781
Note:  The above errors were find on the URL you posted.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1274782
Did my answer work?  If so please grade.  If not, what problem is occuring?
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question