PDA

View Full Version : script errors with AnyLink Drop Down Menu



davka
09-12-2006, 08:24 PM
1) Script Title: AnyLink Drop Down Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Describe problem:

I am trying to make the drop-down menus integrate with my site code (http://www.davka.com/cgi-bin/index-css.cgi , for now) and all I get is JavaScript errors in Firefox like:

Error: unterminated string literal
Source File: http://www.davka.com/cgi-bin/index-css.cgi
Line: 112, Column: 15
Source Code:
document.write('<div id="dropmenudiv"

I put the CSS part into my usual CSS as follows:

<style type="text/css">

#dropmenudiv{
position:absolute;
border:1px solid black;
border-bottom-width: 0;
font:normal 12px Verdana;
line-height:18px;
z-index:100;
}

#dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;

border-bottom: 1px solid black;
padding: 1px 0;
text-decoration: none;
font-weight: bold;
}

#dropmenudiv a:hover{ /*hover background color*/
background-color: yellow;
}

<!--

input {font-family: verdana, Arial, Helvetica, sans-serif; font-size: 11px;}
.h {color: blue; font-size: 13px;}
select {font-family: verdana, Arial, Helvetica, sans-serif; font-size: 11px;}
option {font-family: verdana, Arial, Helvetica, sans-serif; font-size: 11px;}
th {font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
td {font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
p {font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
li {font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
body {font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
h1 { font-family:verdana,arial,sans-serif,helvetica; font-size:17px; color:#333$
h2 { font-family:verdana,arial,sans-serif,helvetica; font-size:14px; color:#333$
h3 { font-family:verdana,arial,sans-serif,helvetica; font-size:13px; color:#333$
a.m:link, a.m:visited, a.m:active { font-family: verdana,arial,sans-serif; text$
$special_style
a.m:hover { font-family: verdana,arial,sans-serif; text-decoration:none; font-s$
a.ml:link, a.ml:visited, a.ml:active, a.ml:hover { font-family: verdana,arial,s$
.menuBox { position:absolute; visibility:hidden; overflow:hidden; font-family: $
-->
</style>

I put the JavaScript part into my <head> as follows:

<script type="text/javascript">

/***********************************************
* AnyLink Drop Down Menu- (c) Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()

menu1[0]='<a href="category.cgi?category=1">Jewish Life and History</a>'
menu1[1]='<a href="category.cgi?category=2">Hebrew Word Processing</a>'
menu1[2]='<a href="category.cgi?category=3">Jewish Clipart / Graphics</a>'
menu1[3]='<a href="category.cgi?category=4">Jewish Texts</a>'
menu1[4]='<a href="category.cgi?category=5">Hebrew Language</a>'
menu1[5]='<a href="category.cgi?category=6">Innovative Ideas</a>'
menu1[6]='<a href="category.cgi?category=7">Jewish Holidays</a>'
menu1[7]='<a href="category.cgi?category=8">Educational Games</a>'
menu1[8]='<a href="category.cgi?category=9">MP3/iPod/Palm Software</a>'
menu1[9]='<a href="category.cgi?category=10">9.95 Classics</a>'
menu1[10]='<a href="category.cgi?category=12">Hebrew Fonts</a>'
menu1[11]='<a href="category.cgi?category=13">Tutorials</a>'
menu1[12]='<a href="category.cgi?category=14">Bible Study</a>'
menu1[13]='<a href="category.cgi?category=15">Daf Yomi</a>'
menu1[14]='<hr>'
menu1[15]='<a href="category.cgi?category=new">New Products</a>'
menu1[16]='<a href="category.cgi?category=sale">Sale Specials</a>'
menu1[17]='<a href="category.cgi?category=bundles">Bundle Deals</a>'
menu1[18]='<a href="category.cgi?category=upgrade">Upgrade Center</a>'
menu1[19]='<a href="product.cgi?product=109">Gift Certificates</a>'
menu1[20]='<a href="vip.cgi">VIP Membership</a>'
menu1[21]='<a href="softwareindex.cgi?platform=pcnum">Software Index</a>'
menu1[22]='<a href="softwareindex.cgi?platform=macnum">Mac Software Index</a>'

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="customer.cgi">Customer Support</a>'
menu2[1]='<a href="techsupport.cgi">Technical Support</a>'
menu2[2]='<hr>'
menu2[3]='<a href="shipping.cgi?full=1">Shipping FAQ</a>'

var menuwidth='165px' //default menu width
var menubgcolor='lightyellow' //menu bgcolor
var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

etc., and just pasted the basic content, and here's the referring HTML:

<table width="726" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" width="105" height="26"><a href="category.cgi?category=index" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '')" onMouseout="delayhidemenu()"><img src="../Images/website2003/buttonshopnow.gif" width="105" height="26" border="0" alt="Shop Now!"></a></td>
<td align="left" valign="top" width="107" height="26"><a href="techsupport.cgi" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu2, '')" onMouseout="delayhidemenu()"><img src="../Images/website2003/buttonsupport.gif" width="107" height="26" border="0" alt="Support"></a></td>
<td align="left" valign="top" width="107" height="26"><a href="educators.cgi"><img src="../Images/website2003/buttoneducators.gif" width="107" height="26" border=0 alt="Educators"></a></td>

<td align="left" valign="top" width="107" height="26"><a href="about.cgi"><img src="../Images/website2003/buttonaboutdavka.gif" width="107" height="26" border=0 alt="About Davka"></a></td>
<td align="left" valign="top" width="107" height="26"><a href="contact.cgi"><img src="../Images/website2003/buttoncontactus.gif" width="107" height="26" border=0 alt="Contact Davka"></a></td>
<td align="left" valign="top" width="151" height="26"><a href="dada/mail.cgi"><img src="../Images/website2003/emailsubscription.gif" width="151" height="26" alt="E-mail Subscriptions" border=0></a></td>
<td align="left" valign="top" width="51" height="26"><img src="../Images/website2003/buttonblank.gif" width="51" height="26"></td> </tr>
</table>

Any idea what I may have done wrong?

jscheuer1
09-13-2006, 04:48 AM
This:


document.write('<div id="dropmenudiv"
style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'"
onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

Should be all one line:


document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

There could be other problems as well.