Java Reference
In-Depth Information
showDescription(num);
currentNum = num;
}
}
}
}
function showDescription(num)
{
var attributes = new Object();
attributes.id = “tabStrip-desc-” + num;
var div = new Element(“div”, attributes)
.appendText(“Description for tab “ + num);
$(“descContainer”).adopt(div);
}
function deactivateTab()
{
var descEl = $(“tabStrip-desc-” + currentNum);
if (descEl)
{
descEl.dispose();
$(“tabStrip-tab-” + currentNum)
.toggleClass(“tabStrip-tab-click”);
}
}
var handlers = new Object();
handlers.mouseover = handleEvent;
handlers.mouseout = handleEvent;
handlers.click = handleEvent;
document.addEvents(handlers);
</script>
</head>
<body>
<div class=”tabStrip”>
<div id=”tabStrip-tab-1” class=”tabStrip-tab”>Tab 1</div>
<div id=”tabStrip-tab-2” class=”tabStrip-tab”>Tab 2</div>
<div id=”tabStrip-tab-3” class=”tabStrip-tab”>Tab 3</div>
</div>
<div id=”descContainer”></div>
</body>
</html>
Save this fi le as ch15_examp7.htm , and open it in any browser supported by MooTools. Notice that this
page works just like all the other versions.
Let's jump right into the code, starting with the handleEvent() function.
function handleEvent(e)
{
var el = $(e.target);
Search WWH ::




Custom Search