Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Java Script Menu Bar


DWadmin

Recommended Posts

Posted

Hi.... I am wanting my left colum menu to look similar to Madame S...

is there anyone that can help me make this happen for my site... Dare Ware

 

Any help would be greatful, thank you.

 

-Ismael

Dare Ware

Posted

Well the problem is that I everytime you click on a menu item it reloads the page. I want it to not reload the page just have the menu drop down. If you look at Madame S's site, you'll see that the they used a javascript code that makes the menu load when you first come the site. When you click on a category, the menu then drops down the sub categories underneath it without having to reload the entire page. I know Javascripting is possible with PHP I'm just not sure how to do it. If this is not possible with this build of OSC then that's fine, I'm just trying to find out if there is a way I can get this done right now.

Thanks.

Posted

You can't view the source to get the script? I couldn't stay on the site, I'm at work and didn't need that site up on my screen!

 

Ryan

If I was crafty, this would be a funny signature.

Posted

this is the script

script language="JavaScript" type="text/JavaScript">

<!--

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

 

function MM_displayStatusMsg(msgStr) { //v1.0

  status=msgStr;

  document.MM_returnValue = true;

}

 

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

  if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

 

      menuArray = new Array();

 

      function getCookie(name) {

        var Cookies = document.cookie.split(/;\s*/);

        for (var i=0; i < Cookies.length; i++) {

          if (Cookies.split(/=/,1)[0] == name) {

            return Cookies.replace(/^[^=]+=/,"");

          }

        }

        return "";

      }

 

      function initMenus() {

        // Read in the cookie and parse it into menuArray

        var menuCookie = getCookie("visibleMenus");

        var menuVisible = menuCookie.split(/,/);

        for (var i=0; i < menuVisible.length; i++) {

          menuArray[menuVisible] = 1;

        }

 

        for (var i=1, menu; menu=document.getElementById("menuContent"+i); i++) {

          if (!menuArray && document.images["menuImg"+i]) {

            document.images["menuImg"+i].src = "/images/custom/closed.gif";

            menu.style.visibility = "Hidden";

            menu.style.display = "none";

          }

        }

      }

 

      function setMenuCookie() {

        var menuCookie = "visibleMenus=";

        for (var i=1; i < menuArray.length; i++) {

          if (menuArray) {

            menuCookie += i+",";

          }

        }

menuCookie += ";PATH=/";

        document.cookie = menuCookie;

      }

 

      function toggleMenu(number) {

        var image = document.images["menuImg"+number];

        var menu = document.getElementById("menuContent"+number);

        if (menuArray[number]) {

          // menu is visible, make it invisible

          menuArray[number] = 0;

          image.src = "/images/custom/closed.gif";

          menu.style.visibility = "Hidden";

          menu.style.display = "none";

        } else {

          // menu is invisible, make it visible

          menuArray[number] = 1;

          image.src = "/images/custom/opened.gif";

          menu.style.visibility = "Visible";

          menu.style.display = "block";

        }

        setMenuCookie();

      }

//-->

</script>

 

and this is the function to call it

 

<a href="java script: toggleMenu(3)"><IMG NAME="menuImg3" SRC="/images/custom/opened.gif" WIDTH=7 HEIGHT=7 BORDER=0></a><span class="area"><b><A HREF="java script: toggleMenu(3)" CLASS="bar_no_link">Bondage</A></b></span>

 

they are also using a custom style sheet so you would have to make your own to suit

Its not a computer its a life management system!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...