Solved

frame

Posted on 2004-04-17
17
1,045 Views
Last Modified: 2010-08-05
Hey guys

i made the following buttons in java.I want it so that whenever someone click on any of these buttons. For example if they click the first button it will take them to cnn.com. now this works it opens a new windows and it takes you to cnn.com but i want it so that the target website in this case cnn.com open in a frame that i have created and i name the frame mainpage.  in html i use to use target="mainpage"    but i don't know if that's how you do it in here too.




Menu3=new Array("Journals","blank.htm","",6);
            
      Menu3_1=new Array("علمي","http://www.cnn.com","",0,20,150);
      Menu3_2=new Array("فرهنگي","http://www.abcnews.com","",0);
      Menu3_3=new Array("سياسي","http://www.msnbc.com","",0);
        Menu3_4=new Array("اقتصادي","http://www.cbsnews.com","",0);
      Menu3_5=new Array("هنري","http://www.disnep.com","",0);
      Menu3_6=new Array("تاريخي","http://www.yahoo.com","",0);
      
             
Menu4=new Array("Photos","blank.htm","",7);
      Menu4_1=new Array("انقلابي","http://www.download.com","",0,20,150);
      Menu4_2=new Array("ايران","http://www.google.com","",0);
      Menu4_3=new Array("تاريخي","http://www.yahoo.com","",0);
      Menu4_4=new Array("هنري","http://www.yahoo.com","",0);
      Menu4_5=new Array("پهلوي","http://www.yahoo.com","",0);
      Menu4_6=new Array("قبل از 1357","http://www.yahoo.com","",0);
      Menu4_7=new Array("بعد از 1357","http://www.yahoo.com","",0);
      

Menu5=new Array("Music","blank.htm","",1);
      Menu5_1=new Array("آهنگهاي انقلابي","ftp:http://mihanam.com'","",0,20,180);
      

Menu6=new Array("Archive","javascript:top.location.href='blank.htm'","",0);
      

Menu7=new Array("Didaniha","/more/page.htm","",0);
     
Menu8=new Array("Joke","http://www.google.com","",0);

Menu9=new Array("Links","http://www.google.com","",5);
      Menu9_1=new Array("اخبار","http://www.google.com","",0,20,180);
      Menu9_2=new Array("موزيک","http://www.google.com","",0);
      Menu9_3=new Array("راديو و تلوزيون","http://www.google.com","",0);
      Menu9_4=new Array("ورزشي","http://www.google.com","",0);
      Menu9_5=new Array("از همه جا","http://www.google.com","",0);

      
0
Comment
Question by:punjabijatt
[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
17 Comments
 
LVL 12

Assisted Solution

by:venkateshwarr
venkateshwarr earned 50 total points
ID: 10848835
try

target="mainpage.subframe"
0
 

Author Comment

by:punjabijatt
ID: 10848855
dude but wher in the menu line should i put that
0
 

Author Comment

by:punjabijatt
ID: 10848881

i added the following function and i added a line to menu 3 check if anything is wrong cause it is not working. thanks.


function loadframe(url,target)
      {
      parent.frames[target].location.href = url;
      }



// Menu tree
//      MenuX=new Array(Text to show, Link, background image (optional), number of sub elements, height, width);
//      For rollover images set "Text to show" to:  "rollover:Image1.jpg:Image2.jpg"
Menu1=new Array("Main","http://www.mihanam.com","",0,20,97);

Menu2=new Array("Home","javascript:top. location.href='/david/mihanam/index.asp'","",0);

Menu3=new Array("Journals","blank.htm","",6);
            
Menu3_1=new Array("علمي","javascript: loadframe('http://www.cnn.com','mainpage') ","",0,20,150);
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

 

Author Comment

by:punjabijatt
ID: 10848902
see this javascript is separate. which holds only the menu as you know.

and the actual index.html is another file that has a frame named mainpage.

i used the function above but it does not work.
0
 

Author Comment

by:punjabijatt
ID: 10848910
now when i run the page and i try to click the page it says mainpage undefined.
0
 

Author Comment

by:punjabijatt
ID: 10848926
http://html.megalink.com/programmer/tips/multilink.html



the above is the link i got the code from.
see if you understand it better.
thanks
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 10848935
It will help more to see how menu is creating the link

Also load the page in Mozilla and see the javascript console
0
 
LVL 1

Expert Comment

by:bkiahg
ID: 10848955
Post the entire relevant webpage here or somewhere accessible on the net, please.  The complete javascript and the html that is calling it or where it is placed.

Thanks
0
 

Author Comment

by:punjabijatt
ID: 10848964
here is the menu java script.


/***********************************************************************************
*      (c) Ger Versluis 2000 version 5.411 24 December 2001 (updated Jan 31st, 2003 by Dynamic Drive for Opera7)
*      For info write to menus@burmees.nl                      *
*      You may remove all comments for faster loading                *            
***********************************************************************************/

      var NoOffFirstLineMenus=10;                  // Number of first level items
      var LowBgColor='khaki';                  // Background color when mouse is not over
      var LowSubBgColor='white';                  // Background color when mouse is not over on subs
      var HighBgColor='green';                  // Background color when mouse is over
      var HighSubBgColor='black';                  // Background color when mouse is over on subs
      var FontLowColor='black';                  // Font color when mouse is not over
      var FontSubLowColor='black';                  // Font color subs when mouse is not over
      var FontHighColor='white';                  // Font color when mouse is over
      var FontSubHighColor='white';                  // Font color subs when mouse is over
      var BorderColor='black';                  // Border color
      var BorderSubColor='black';                  // Border color for subs
      var BorderWidth=1;                        // Border width
      var BorderBtwnElmnts=1;                  // Border between elements 1 or 0
      var FontFamily="arial,comic sans ms,technical"      // Font family menu items
      var FontSize=12;                        // Font size menu items
      var FontBold=1;                        // Bold menu items 1 or 0
      var FontItalic=0;                        // Italic menu items 1 or 0
      var MenuTextCentered='left';                  // Item text position 'left', 'center' or 'right'
      var MenuCentered='center';                  // Menu horizontal position 'left', 'center' or 'right'
      var MenuVerticalCentered='top';            // Menu vertical position 'top', 'middle','bottom' or static
      var ChildOverlap=.2;                        // horizontal overlap child/ parent
      var ChildVerticalOverlap=.2;                  // vertical overlap child/ parent
      var StartTop=160;                        // Menu offset x coordinate
      var StartLeft=1;                        // Menu offset y coordinate
      var VerCorrect=0;                        // Multiple frames y correction
      var HorCorrect=0;                        // Multiple frames x correction
      var LeftPaddng=0;                        // Left padding
      var TopPaddng=1;                        // Top padding
      var FirstLineHorizontal=1;                  // SET TO 1 FOR HORIZONTAL MENU, 0 FOR VERTICAL
      var MenuFramesVertical=1;                  // Frames in cols or rows 1 or 0
      var DissapearDelay=1000;                  // delay before menu folds in
      var TakeOverBgColor=1;                  // Menu frame takes over background color subitem frame
      var FirstLineFrame='navig';                  // Frame where first level appears
      var SecLineFrame='space';                  // Frame where sub levels appear
      var DocTargetFrame='space';                  // Frame where target documents appear
      var TargetLoc='';                        // span id for relative positioning
      var HideTop=0;                        // Hide first level when loading new document 1 or 0
      var MenuWrap=1;                        // enables/ disables menu wrap 1 or 0
      var RightToLeft=0;                        // enables/ disables right to left unfold 1 or 0
      var UnfoldsOnClick=0;                  // Level 1 unfolds onclick/ onmouseover
      var WebMasterCheck=0;                  // menu tree checking on or off 1 or 0
      var ShowArrow=1;                        // Uses arrow gifs when 1
      var KeepHilite=1;                        // Keep selected path highligthed
      var Arrws=['tri.gif',5,10,'tridown.gif',10,5,'trileft.gif',5,10];      // Arrow source, width and height

function BeforeStart(){return}
function AfterBuild(){return}
function BeforeFirstOpen(){return}
function AfterCloseAll(){return}

function loadframe(url,target)
      {
      parent.frames[mainpage].location.href = index.asp;
      }



// Menu tree
//      MenuX=new Array(Text to show, Link, background image (optional), number of sub elements, height, width);
//      For rollover images set "Text to show" to:  "rollover:Image1.jpg:Image2.jpg"
Menu1=new Array("Main","http://www.mihanam.com","",0,20,97);

Menu2=new Array("Home","javascript:top. location.href='/david/mihanam/index.asp'","",0);

Menu3=new Array("Journals","blank.htm","",6);
            
      Menu3_1=new Array("علمي","javascript: loadframe('http://www.cnn.com','mainpage') ","",0,20,150);
      Menu3_2=new Array("فرهنگي","http://www.abcnews.com","",0);
      Menu3_3=new Array("سياسي","http://www.msnbc.com","",0);
        Menu3_4=new Array("اقتصادي","http://www.cbsnews.com","",0);
      Menu3_5=new Array("هنري","http://www.disnep.com","",0);
      Menu3_6=new Array("تاريخي","http://www.yahoo.com","",0);
      
             
Menu4=new Array("Photos","blank.htm","",7);
      Menu4_1=new Array("انقلابي","http://www.download.com","",0,20,150);
      Menu4_2=new Array("ايران","http://www.google.com","",0);
      Menu4_3=new Array("تاريخي","http://www.yahoo.com","",0);
      Menu4_4=new Array("هنري","http://www.yahoo.com","",0);
      Menu4_5=new Array("پهلوي","http://www.yahoo.com","",0);
      Menu4_6=new Array("قبل از 1357","http://www.yahoo.com","",0);
      Menu4_7=new Array("بعد از 1357","http://www.yahoo.com","",0);
      

Menu5=new Array("Music","blank.htm","",1);
      Menu5_1=new Array("آهنگهاي انقلابي","ftp:http://mihanam.com'","",0,20,180);
      

Menu6=new Array("Archive","javascript:top.location.href='blank.htm'","",0);
      

Menu7=new Array("Didaniha","/more/page.htm","",0);
     
Menu8=new Array("Joke","http://www.google.com","",0);

Menu9=new Array("Links","http://www.google.com","",5);
      Menu9_1=new Array("اخبار","http://www.google.com","",0,20,180);
      Menu9_2=new Array("موزيک","http://www.google.com","",0);
      Menu9_3=new Array("راديو و تلوزيون","http://www.google.com","",0);
      Menu9_4=new Array("ورزشي","http://www.google.com","",0);
      Menu9_5=new Array("از همه جا","http://www.google.com","",0);

      

Menu10=new Array("Downloads","http://www.google.com","",5);
      Menu10_1=new Array("Interview & Speech","http://google.com","",0,20,180);
      Menu10_2=new Array("Programs","http://www.google.com","",0);
      Menu10_3=new Array("فرهنگي و هنري","http://www.google.com","",0);
      Menu10_4=new Array("افشاگري","http://2advanced.com","",0);
      Menu10_5=new Array("Video_clips","http://geocities.com","",0);
      

-

(--------------------------------------------------------------------------------------------------------

so the above is just the menu and where i call all this my index.html page is below.



<html>
<head>
<meta http-equiv="content-type" content="text/html;  charset=windows-1256">
</head>



<body bgcolor="gray" text="white">

<script type='text/javascript'>

//HV Menu v5.411- by Ger Versluis (http://www.burmees.nl/)
//Submitted to Dynamic Drive (http://www.dynamicdrive.com)
//Visit http://www.dynamicdrive.com for this script and more

function Go(){return}

</script>
<script type='text/javascript' src='exmplmenu_var.js'></script>
<script type='text/javascript' src='menu_com.js'></script>
<noscript>Your browser does not support script</noscript>

<!-- #include file="top.asp" -->

<br>
<table border="1" width="100%">
  <tr>
    <td width="100%" colspan="3">
   
   
     
    </td>
  </tr>
  <tr>
    <td>
   
    <!-- #include file="leftnav.asp" -->
   
    </td>
    <td width="70%">
<frameset rows="100,*">
<frame name="mainpage">
</frameset>

    <td width="10%">
   
<!-- #include file="rightnav.asp" -->
   
    </td>
  </tr>
  <tr>
    <td width="100%" colspan="3" valign="middle" align="center">
   
<!-- #include file="bottom.asp" -->
   
    </td>
  </tr>
</table>
</body>
</html>
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10849287
Change this three vars to your frame names:

     var FirstLineFrame='navig';               // Frame where first level appears
     var SecLineFrame='space';               // Frame where sub levels appear
     var DocTargetFrame='space';               // Frame where target documents appear

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10849323
And rewrite this function:

function loadframe(url,target)
     {
     parent.frames.mainpage.location.href = "index.asp";
     }


The regualr form of the function has to be:

function loadframe(url,target)
     {
     parent.frames[target].location.href = url;
     }

Bur when you do not use the parementers, then you have to hardcode the names.

Als I do not see nowhere your "mainpage" frame. Are you sure you have a frameset?

0
 

Author Comment

by:punjabijatt
ID: 10850489
the frame is in their the html take a los ok it says

 <td width="70%">
<frameset rows="100,*">
<frame name="mainpage">
</frameset>
0
 

Author Comment

by:punjabijatt
ID: 10850532
ok i changed the script


var FirstLineFrame='mainpage';                  // Frame where first level appears
      var SecLineFrame='mainpage';                  // Frame where sub levels appear
      var DocTargetFrame='space';

i also changed the loadframe function



function loadframe(url,target)
      {
      parent.frames.mainpage.location.href="index.asp";
      }


but when i click on the link it still says "error on page" and it does not display the page in that frame.
h

here is the link to the webpage that i have up so far.

the link that i am trying to get to work for now is  under journals the first link.

http://www.mihanam.com/mihanam/index.asp
0
 

Author Comment

by:punjabijatt
ID: 10850627
help me get this working man please.

i will be so grateful to you.

thanks

punjabijatt
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10850713
Rename it to IFRAME
Like this:

<td width="70%">
<iframe name="mainpage">
</iframe>

0
 
LVL 63

Accepted Solution

by:
Zvonko earned 250 total points
ID: 10850784
Expand your iframe to full size:

<iframe name="mainpage" width="100%" height="100%" >
</iframe>


And change this vars in exmplmenu_var.js:
      var FirstLineFrame='self';                  // Frame where first level appears
      var SecLineFrame='self';                  // Frame where sub levels appear
      var DocTargetFrame='mainpage';                  // Frame where target documents appear


And your loadframe() should be like this:

function loadframe(url,target)
      {
      parent.frames[target].location.href=url;
      }



0
 

Author Comment

by:punjabijatt
ID: 10851132
alright let me try that


thanks

for
responding
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

726 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