Current location: Hot Scripts Forums » General Web Coding » JavaScript » Plz Help! Drop Down selection opens 2 frames


Plz Help! Drop Down selection opens 2 frames

Reply
  #1 (permalink)  
Old 08-12-03, 01:11 PM
ppt ppt is offline
New Member
 
Join Date: Aug 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Plz Help! Drop Down selection opens 2 frames

I need help with a 3 frame page where I want the top navigation frame to include a drop down menu. The items on the menu need to be linked to open 2 different frames. My javascript skills are very basic - having always used share scripts in the past. I merged the following two shareware scripts with the following errors resulting. So I am sure I am missing something basic....

The following code produces 2 runtime errors-
"Expected" ';'
'menu 1' is undefined

I would really appreciate if someone could review the following and point out my errors and or suggest another script. Thanks!

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>

<script language="JavaScript1.2">

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="javascript:loadFrames('test1.htm','coursedes criptions.htm#24-36','schedulestest.htm#24-36')">Parenting for Tots 24 to 36 Months</a>
<br>'

menu1[1]='<a href=test.htm>Menu link here</a><br>'
menu1[2]='<a href=test.htm>Menu link here</a><br>'


</script>
<SCRIPT LANGUAGE="JavaScript">



<!-- Begin
function loadFrames(page1, page2, page3) {
framecode = "<frameset rows='33%,33%,*'>"
+ "<frame src='" + page1 + "'>"
+ "<frame src='" + page2 + "'>"
+ "<frame src='" + page3 + "'>"
+ "</frameset>";

page = window.open("");
page.document.open();
page.document.write(framecode);
page.document.close();
}
// End -->
</script>

<style>
<!--
.iewrap1{
position:relative;
height:30px;
}
.iewrap2{
position:absolute;
}
#dropmenu0{
visibility:hide;
z-index:100;
}
-->
</style>





</head>

<body>
<table>
<tr>
<td width="634" colspan="5" valign="middle">
<hr width="90%" color="#000099">
</td>
</tr>
<tr>
<td width="634" valign="top" colspan="5">Select Classes by Subject</td>
</tr>
<tr>
<td width="628" colspan="5">&nbsp;
<script language="JavaScript1.2">
//reusable/////////////////////////////
var zindex=100
function dropit2(whichone){
if (window.themenu&&themenu.id!=whichone.id)
themenu.style.visibility="hidden"
themenu=whichone
if (document.all){
themenu.style.left=document.body.scrollLeft+event. clientX-event.offsetX
themenu.style.top=document.body.scrollTop+event.cl ientY-event.offsetY+18
if (themenu.style.visibility=="hidden"){
themenu.style.visibility="visible"
themenu.style.zIndex=zindex++
}
else{
hidemenu()
}
}
}

function dropit(e,whichone){
if (window.themenu&&themenu.id!=eval(whichone).id)
themenu.visibility="hide"
themenu=eval(whichone)
if (themenu.visibility=="hide")
themenu.visibility="show"
else
themenu.visibility="hide"
themenu.zIndex++
themenu.left=e.pageX-e.layerX
themenu.top=e.pageY-e.layerY+19
return false
}

function hidemenu(whichone){
if (window.themenu)
themenu.style.visibility="hidden"
}

function hidemenu2(){
themenu.visibility="hide"
}

if (document.all)
document.body.onclick=hidemenu

//reusable/////////////////////////////
</script>

<!----------Menu 1 starts here---------->

<ilayer height=35px>
<layer visibility=show>
<span class=iewrap2 onClick="dropit2(dropmenu0);event.cancelBubble=tru e;return false"><font face=Verdana><b><a href="alternate.htm" onClick="if(document.layers) return dropit(event, 'document.dropmenu0')">Parents</a></b></font>
</span>
</span>
</layer>
</ilayer>




</td>
</tr>
</table>

<div id=dropmenu0 style="position:absolute;left:0;top:0;layer-background-color:lightyellow;background-color:lightyellow;width:120;visibility:hidden;bord er:2px solid black;padding:0px">
<script language="JavaScript1.2">
if (document.all)
dropmenu0.style.padding="4px"
for (i=0;i<menu1.length;i++)
document.write(menu1[i])
</script>
</div>
</body>

</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-13-03, 09:58 AM
jewellgr jewellgr is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Michigan USA
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
I looked at your script and the problem was with your array "menu1".

I changed
menu1[0]='<a href="java script:loadFrames('test1.htm','coursedescriptions. htm#24-36','schedulestest.htm#24-36')">Parenting for Tots 24 to 36 Months</a>
<br>'

menu1[1]='<a href=test.htm>Menu link here</a><br>'
menu1[2]='<a href=test.htm>Menu link here</a><br>'

to

menu1[0]="<a href=\"javascript:loadFrames('test1.htm','coursede scriptions.htm#24-36','schedulestest.htm#24-36')\">Parenting for Tots 24 to 36 Months</a><br>";

menu1[1]="<a href=test.htm>Menu link here</a><br>";
menu1[2]="<a href=test.htm>Menu link here</a><br>";
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 08-13-03, 12:08 PM
ppt ppt is offline
New Member
 
Join Date: Aug 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for your speedy response jewellgr! I'll revise my code and let you know. ppt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-27-04, 12:54 PM
barbaraerrico barbaraerrico is offline
New Member
 
Join Date: Mar 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Drop Down Menu

I saw your script, but how do you get a link to open a new window with a customized setting (400 x 500) target="_blank"

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>

<script language="JavaScript1.2">

//Contents for menu 1
var menu1=new Array()
menu1[0]="<a href=\"java_script_:loadFrames ('office.htm',)\">Office</a><br>";
menu1[1]="<a href=\"java_script_:loadFrames('industrial.htm',)\ ">Industrial</a><br>";
menu1[2]="<a href=\"java_script_:loadFrames('lifesciences.htm', )\">Lifesciences</a><br>";
menu1[3]="<a href=\"java_script_:loadFrames('retail.htm',)\">Re tail</a><br>";

</script>
<SCRIPT LANGUAGE="JavaScript">



<!-- Begin
function loadFrames(page1, page2, page3, page4) {
framecode = "<frameset rows='33%,33%,*'>"
+ "<frame src='" + page1 + "'>"
+ "<frame src='" + page2 + "'>"
+ "<frame src='" + page3 + "'>"
+ "<frame src='" + page4 + "'>"
+ "</frameset>";

page = window.open("");
page.document.open();
page.document.write(framecode);
page.document.close();
}
// End -->
</script>

<style>
<!--
.iewrap1{
position:relative;
height:30px;
}
.iewrap2{
position:absolute;
}
#dropmenu0{
visibility:hide;
z-index:100;
}
-->
</style>





</head>

<body link="#000000" vlink="#000000" alink="#000000">

<script language="JavaScript1.2">
//reusable/////////////////////////////
var zindex=100
function dropit2(whichone){
if (window.themenu&&themenu.id!=whichone.id)
themenu.style.visibility="hidden"
themenu=whichone
if (document.all){
themenu.style.left=document.body.scrollLeft+event. clientX-event.offsetX
themenu.style.top=document.body.scrollTop+event.cl ientY-event.offsetY+18
if (themenu.style.visibility=="hidden"){
themenu.style.visibility="visible"
themenu.style.zIndex=zindex++
}
else{
hidemenu()
}
}
}

function dropit(e,whichone){
if (window.themenu&&themenu.id!=eval(whichone).id)
themenu.visibility="hide"
themenu=eval(whichone)
if (themenu.visibility=="hide")
themenu.visibility="show"
else
themenu.visibility="hide"
themenu.zIndex++
themenu.left=e.pageX-e.layerX
themenu.top=e.pageY-e.layerY+19
return false
}

function hidemenu(whichone){
if (window.themenu)
themenu.style.visibility="hidden"
}

function hidemenu2(){
themenu.visibility="hide"
}

if (document.all)
document.body.onclick=hidemenu

//reusable/////////////////////////////
</script>

<!----------Menu 1 starts here---------->

<ilayer height=35px>
<layer visibility=show>
<span class=iewrap2 onClick="dropit2(dropmenu0);event.cancelBubble=tru e;return false"><font face=Arial><b><a href="alternate.htm" onClick="if(document.layers) return dropit(event, 'document.dropmenu0')"> <img SRC="http://www.berrico.com/tmo/images/33aportfolio.jpg" BORDER="0" NAME="object3" ALT="Portfolio" width="55" height="23"></a></b></font>
</span>
</span>
</layer>
</ilayer>

<div id=dropmenu0 style="position:absolute;left:0;top:0;background-color:#8093AE;;width:80;visibility:hidden;border:1 px solid black;padding:0px">


<script language="JavaScript1.2">
if (document.all)
dropmenu0.style.padding="4px"
for (i=0;i<menu1.length;i++)
document.write(menu1[i])
</script>
</div>

</body>

</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP theme selection script TMD PHP 2 09-22-03 04:43 AM
drop the lowest number TheLaughingBandit ASP 2 08-30-03 02:57 PM
One form communication across multiple frames Greg JavaScript 0 07-07-03 02:16 PM


All times are GMT -5. The time now is 10:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.