Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble trying to open a link from a menu into a new page

Status
Not open for further replies.

skills

Programmer
Jun 24, 2003
60
US
I have a drop down menu. I am trying to set it up so that when the link is clicked, the page, or in my case the pdf loads ina new window. I have tried target:"_new" and target:"_blank" already with no success. Below is the code.

menus[4] = {mBarImgId:"menuImg_5",
mBarImgNormal:imagesNormal["about2"],
mBarImgHilite:imagesHilite["about2"],
menuItems:[ {text:"Standard Designs",
href:"std_design.pdf"},
{text:"Standard Type Styles",
href:"std_type_styles.pdf"},
{text:"Standard Monograms",
href:"std_monogram.pdf"}
],
elemId:""
};

Thanks,

Skills
 
The problem most likely lies in the code to actually create the HTML elements on the page rather than where you set up the parameters for each menu object.

Are you certain that the script you have supports opening new windows?

You may need to either post the code (or preferrably point us to where you got it from) to get a more informed response.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

AU.gif
Check out Tek-Tips Australia New Zealand forum1155
NZ.gif
 
Ok, I have posted the code from the .js file on another webpage of mine. the website is:

The main website code is shown below in red. The css file is shown in blue.



<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;<!--
Example File From &quot;JavaScript and DHTML Cookbook&quot;
Published by O'Reilly & Associates
Copyright 2003 Danny Goodman
-->
<html>
<head>
<title>Recipe 10.8</title>
<style id=&quot;main&quot; type=&quot;text/css&quot;>
body {background-color:#eeeeee; font-family:Arial,Helvetica,sans-serif; font-size:12px;}
h1 {font-size:1.8em; font-weight:bold}
h2 {font-size:1.5em; font-weight:bold}
</style>
<link rel=&quot;stylesheet&quot; href=&quot;menus.css&quot; type=&quot;text/css&quot; />
<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot; src=&quot;menus.js&quot;></script>
</head>
<body onload=&quot;initMenus()&quot;>
<div id=&quot;menubar&quot; style=&quot;position: absolute; left: 11px; top: 5px&quot;>

<body background=&quot;background3.jpg&quot;>

<a href=&quot;#&quot;><img id=&quot;menuImg_1&quot;
class=&quot;menuImg&quot; src=&quot;truffle.jpg&quot; border=&quot;0&quot;
height=&quot;20&quot; width=&quot;245&quot;></a>

<a href=&quot;#&quot;><img id=&quot;menuImg_2&quot;
class=&quot;menuImg&quot; src=&quot;wedding.jpg&quot; border=&quot;0&quot;
height=&quot;20&quot; width=&quot;245&quot;></a>

<a href=&quot;#&quot;><img id=&quot;menuImg_3&quot;
class=&quot;menuImg&quot; src=&quot;corperate.jpg&quot; border=&quot;0&quot;
height=&quot;20&quot; width=&quot;245&quot;></a>

<a href=&quot;#&quot;><img id=&quot;menuImg_4&quot;
class=&quot;menuImg&quot; src=&quot;personal.jpg&quot; border=&quot;0&quot;
height=&quot;20&quot; width=&quot;245&quot;></a>

<a href=&quot;#&quot;><img id=&quot;menuImg_5&quot;
class=&quot;menuImg&quot; src=&quot;designs.jpg&quot; border=&quot;0&quot;
height=&quot;20&quot; width=&quot;245&quot;></a>

<a href=&quot;about3.html&quot;><img id=&quot;menuImg_6&quot;
class=&quot;menuImg&quot; src=&quot;order.jpg&quot; border=&quot;0&quot;
height=&quot;20&quot; width=&quot;245&quot;></a>

<a href=&quot;about4.html&quot;><img id=&quot;menuImg_7&quot;
class=&quot;menuImg&quot; src=&quot;contact.jpg&quot; border=&quot;0&quot;
height=&quot;20&quot; width=&quot;245&quot;></a>

<a href=&quot;about5.html&quot;><img id=&quot;menuImg_8&quot;
class=&quot;menuImg&quot; src=&quot;about.jpg&quot; border=&quot;0&quot;
height=&quot;20&quot; width=&quot;245&quot;></a>

</div>
<br><br><br><br>
<table width=100%>
<tr>
<td width=33%>
<h1>Let our custom gourmet truffles</h1><br>
<h1>lavish waves of silk delight</h1><br>
<h1>to your palatte</h1><br>
</td>
<td width=33%>
<center><img src=&quot;tray2.gif&quot; width=&quot;233&quot; height=&quot;350&quot; border=&quot;0&quot;></center>
</td>
<td width=33%>
<center>
<h1>Gourmet Truffles <br>For Every Occasion!</h1></center><br>
<h2>Complement your Cake</h2><br>
<h2>                     Dress Up Your <br>
                     Hors D'oeuvre Table</h2><br>
<h2>Say a Sweet Thank You</h2><br>
<h2>                     Captivate Your Clients</h2><br>
<h2>Favors and Gifts</h2><br>
</td>
</tr>
</table>
</body>
</html>



.menuWrapper {

position:absolute;

width:162px;

background-color:#339966;

visibility:hidden;

border-style:solid;

border-width:2px;

border-color:#EFEFEF #505050 #505050 #EFEFEF;

display:block;

padding:3px;

}


.menuItem {

cursor:pointer;

font-size:12px;

font-family:Arial, Helvetica, sans-serif;

border-bottom:1px solid #505050;

border-top:1px solid #EFEFEF;

padding-left:10px;

color:#ffffcc;

background-color:#0066CC;

text-decoration:none;

position:absolute;

left:0px;

width:159px;

height:1.4em;

display:block;

line-height:1.4em

}


.menuItemOn {

cursor:pointer;

font-size:12px;

font-family:Arial, Helvetica, sans-serif;

border-bottom:1px solid #505050;

border-top:1px solid #EFEFEF;

padding-left:10px;

color:#ffffCC;

background-color:#FF0033;

text-decoration:none;

position:absolute;

left:0px;

width:159px;

height:1.4em;

display:block;

line-height:1.4em

}


Thanks,

Skills
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top