close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Calling a JavaScript function from a menu item

Thread began 11/29/2010 3:06 pm by markhaynes75235 | Last modified 12/14/2010 3:27 pm by markhaynes75235 | 3394 views | 4 replies


Calling a JavaScript function from a menu item

Hi Jason:

I've got the site set up on an internal system and I'm working with IT to see if I can share it out to authorized parties.

The script in live code view shows up like this:

<script type="text/javascript">
// Change Text Size by Community MX
// Copyright 2007, All rights reserved
function CMXwriteCookie(n,i,t){
var ep="";if (t){d = new Date();d.setTime(d.getTime()+(t*86400000));
ep = "; expires="+d.toGMTString();}document.cookie = n+"="+i+ep+"; path=/";
window.location.href = window.location.href;
function CMXreadCookie(n){
eq = n+"=";ca = document.cookie.split(';');for(var i=0;i<ca.length;i++) {
c=ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(eq) == 0) return c.substring(eq.length,c.length);}return null;
fSize=(CMXreadCookie('fSize') == null)?11:CMXreadCookie('fSize');

document.write('<style type=\"text/css\">');
document.write('.varText {font-size:'+fSize+'px;}');
</script><style type="text/css">.varText {font-size:11px;}</style>
<script type="text/javascript" src="CSSMenuWriter/cssmw4/menu.js"></script>
<style type="text/css" media="all">
@import url("CSSMenuWriter/cssmw4/menu.css");

followed by a link to a stylesheet for the language translation module then I've set the body to use the class .varText:

<body class="varText">

and then nested inside wrapper and content <div> tags I've got the DIV with the menu:

<div id="services">
<div id="svcsContent">
<div id="textResize">
<ul class="level-0" id="cssmw4">
<li class="parent link"><a href="#" class="link">Choose a Font Size</a>
<ul class="level-1">
<li class="link"><a href="#" onclick="CMXwriteCookie('fSize',11,3650); return false;" style="font-size:11px" class="link">Small &gt; A</a></li>
<li class="link"><a href="#" onclick="CMXwriteCookie('fSize',14,3650); return false;" style="font-size:14px" class="link">Medium &gt; A</a></li>
<li class="link"><a href="#" onclick="CMXwriteCookie('fSize',18,3650); return false;" style="font-size:18px" class="link">Large &gt; A</a></li>
<li class="link"><a href="#" onclick="CMXwriteCookie('fSize',20,3650); return false;" style="font-size:20px" class="link">Larger &gt; A</a></li>

<script type="text/javascript">if(window.attachEvent) { window.attachEvent("onload", function() { cssmw4.intializeMenu('cssmw4',{select_current: 0, orientation: 2}); }); } else if(window.addEventListener) { window.addEventListener("load", function() { cssmw4.intializeMenu('cssmw4',{select_current: 0, orientation: 2}); }, true); }</script>

If you want to set a time when I can show it to you in a Connect session, I'll be happy to schedule the time so we can look at it. I greatly appreciate your help!


Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...