Results 1 to 2 of 2
  1. #1
    10zil is offline Member
    Join Date
    Feb 2013
    Location
    India
    Posts
    3
    Rep Power
    0

    Exclamation What is the use of myTabz.js

    This is a javascript myTabz.js I searched but i dont get the way i wanted.I need know the use of this script,on basis it is written,and what is the sole purpose.

    Thank You


    var mt = Class.create();
    mt.prototype = {
    initialize: function(tabs_container,tabs_class) {

    this.bgcolor='#E5E5E5';
    this.activeColor='#ffe9b5';
    this.tc=tabs_container;
    this.tbClass=tabs_class;
    this.elm = $(tabs_container);

    new Insertion.Top(this.elm,'<div id="tab-bar"></div>');

    this.tabs = $$(tabs_class);
    this.clear(this.tabs);

    MT=this;
    },

    clear: function(tabs){
    tabs.each(function(elm){
    elm.setStyle({display:'none'});
    });
    },

    makeActive: function(tab_id){

    $(tab_id).setStyle({display:'block'});
    $('mt-'+tab_id).setStyle({backgroundColor:MT.activeColor });
    $$('div.mt-tab').each(function(elm){
    if(elm.hasClassName('mt-tab-active')){

    elm.removeClassName('mt-tab-active');
    elm.setStyle({backgroundColor:MT.bgcolor});
    }

    });
    $('mt-'+tab_id).addClassName('mt-tab-active');
    },

    addTab: function(tab_id,text){

    new Insertion.Bottom($('tab-bar'),'<div id="mt-'+tab_id+'" class="mt-tab">'+text+'</div>');
    var elmnt=$('mt-'+tab_id);
    elmnt.setStyle({backgroundColor:this.bgcolor});

    Event.observe(elmnt, 'click', function() {
    if(document.getElementById(tab_id).style.display== 'none')
    {
    window.mt.prototype.clear(MT.tabs);
    window.mt.prototype.makeActive(tab_id,MT.tbClass);
    tabonClickfunction(tab_id,text);
    }
    });

    Event.observe(elmnt, 'mouseover', function(nn) {

    if(!elmnt.hasClassName('mt-tab-active')){
    elmnt.setStyle({backgroundColor:MT.activeColor});
    }
    });

    Event.observe(elmnt, 'mouseout', function(nn) {

    if(!elmnt.hasClassName('mt-tab-active')){
    elmnt.setStyle({backgroundColor:MT.bgcolor});

    }

    });

    },


    removeTabTitles: function(tabTitlesClass){
    this.tabsTitles = $$(tabTitlesClass);
    this.tabsTitles.each(function(elm){
    elm.setStyle({display:'none'});
    });
    }
    };

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: What is the use of myTabz.js

    Java != Javascript.
    You need to find a Javascript forum.

    Closing this thread.
    Please do not ask for code as refusal often offends.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •