//Register NameSpace for window.MSN
if(!window.MSN)
{
window.MSN = {};
}
if(!window.MSN.SET)
{
window.MSN.SET = {};
}
if(!window.MSN.SET.Utilities)
{
window.MSN.Utilities = {};
}
//Check you borwse type
//IE7 &IE8 & FF etc can render hover for div tags, but can't render under IE6.0
//this function can render hover for div under IE6.0 browse
//
MSN.SET.Utilities = {
WebBrowserType: { IE6: 'MSIE 6.0', IE7: 'MSIE 7.0', IE8: 'MSIE 8.0', Firefox: 'Mozilla', Unknow: 'unknow' },
checkUserWebBrowser:function(){
var userAgent = window.navigator.userAgent;
if(userAgent.indexOf(MSN.SET.Utilities.WebBrowserType.IE8) > -1) {
return MSN.SET.Utilities.WebBrowserType.IE8;
}
if(userAgent.indexOf(MSN.SET.Utilities.WebBrowserType.IE7) > -1) {
return MSN.SET.Utilities.WebBrowserType.IE7;
}
if(userAgent.indexOf(MSN.SET.Utilities.WebBrowserType.IE6) > -1){
return MSN.SET.Utilities.WebBrowserType.IE6;
}
if (userAgent.indexOf(MSN.SET.Utilities.WebBrowserType.Firefox) > -1) {
return MSN.SET.Utilities.WebBrowserType.Firefox;
}
return MSN.SET.Utilities.WebBrowserType.Unknow;
}
}
//Start function
//Check you borwse type
//under IE6.0 can't render hover
//this function can render hover for div under IE6.0 browse
//
function $1() {
// check users IE browse
if(window.MSN.SET.Utilities.checkUserWebBrowser() == "MSIE6.0")
{
hover();
};
}
$1();
//define function getElementByClass
//this function only for div tags, and if you want to apply another tags
//please change code /*var allPageTags = document.getElementsByTagName("div");*/
//return an object just like /*document.getElementById*/
document.getElementByClass = function(classname) {
var elements = [];
//populate the array with all the page div tags
var allPageTags = document.getElementsByTagName("div");
//cycle through the tags using a for loop
for (i = 0; i < allPageTags.length; i++) {
//pick out the tags with our class name
fullclassname = allPageTags[i].className;
if (fullclassname.indexOf(classname) > -1) {
elements[elements.length] = allPageTags[i];
}
}
return elements;
}
//change classname for special tags
//find this classname /*nav_section*/ and add /* onhover*/
//example <div class="nav_section section1 onhover">
function hover() {
var onhoveclassname = " onhover";
obj = document.getElementByClass("nav_section");
var currentclassname;
for (var i = 0; i < obj.length; i++) {
obj[i].onmouseover = function() {
currentclassname = this.className;
this.className = currentclassname + onhoveclassname;
};
obj[i].onmouseout = function() {
this.className = currentclassname
};
}
}
jQuery download: http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.js