Home >Web Front-end >JS Tutorial >JMenuTab simple usage instructions_javascript skills
Code example:
var menuLeft = new JMenuTab(null,null,"left");
menuLeft.create();
menuLeft.setSkin("JMenuTabBlue");
menuLeft.setFixHeight(400 ,false,false,true);
menuLeft.addTab("About");
menuLeft.addTab("Xling");
menuLeft.setActiveTab(0);
1, Construction:
function JMenuTab(pWidth,pHeight,pBody)
If pWidth is not specified, it is 100%. If pHeight is not specified, there will be a default height. If pBody is not specified, it will be displayed at the end of BODY . Note: If not specified, null must be used instead. The following writing methods are correct:
var menuLeft = new JMenuTab(null,null,"left");
var menuLeft = new JMenuTab(null,null, null);
var menuLeft = new JMenuTab();
var menuLeft = new JMenuTab(100,100);
2, initial creation:
this.create = function()
This function should be followed immediately after new JMenuTab(...).
3. Set the skin:
this.setSkin = function(pSkin)
pSkin comes from CSS file, such as:
#JMenuTabGreen {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
padding: 2px;
border-right-width: 1px;
border-bottom-width: 1px;
border -left-width: 1px;
}
#JMenuTabGreen .oInnerline {
background-color: #FFFFFF;
}
Then this pSkin can be taken: JMenuTabGreen
4. Set the fixed (minimum) height:
this.setFixHeight = function(pHeight,pAutoExpend,pXScroll,pYScroll)
pHeight refers to the minimum height.
pAutoExpend, refers to whether to automatically expand (if the content height is greater than pHeight), can be null, and can be left blank
pXScroll, refers to whether to display the horizontal scroll axis, can be null, but can be left blank.
pYScroll refers to whether to display the vertical scroll axis. It can be null or left blank.
5, add a label:
this.addTab = function (pLabel,pPageBodyId)
pLabel, refers to the text on the label.
pPageBodyId refers to the ID of the tag content container (DIV, IFRAME, TABLE, etc.). It can be null and can be left blank.
6, used as a normal panel, that is, without tags:
this.setDefaultPage = function(pPageBodyId)
Use this, don’t use addTab anymore,
pPageBodyId is the same as addTab’s pPageBodyId , but: required.
7, set the current label:
this.setActiveTab = function(pIndex)
pIndex is a number, starting from 0. If the index does not exist, it will not be set.