flyout.js
资源名称:MSP430.rar [点击查看]
上传用户:zhihaomold
上传日期:2007-04-17
资源大小:43041k
文件大小:4k
源码类别:
其他
开发平台:
Objective-C
- function browserDetect() {
- ns4 = (document.layers)&&(navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4) ? 'ns4' : false;
- ie4 = (document.all)&&(navigator.appName.indexOf("Microsoft") > -1)&&(parseInt(navigator.appVersion)==4) ? 'ie4' : false;
- ie5 = (document.getElementById)&&(navigator.appName.indexOf("Microsoft") > -1) ? 'ie5' : false;
- ns6 = (document.getElementById)&&(navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)>4) ? 'ns6' : false;
- op5 = (document.getElementById)&&(navigator.appName=="Opera")&&(parseInt(navigator.appVersion)>4) ? 'op5' : false;
- return (ns4 || ie5 || ie4 || ns6 || op5);
- }
- var browser = browserDetect();
- function myDOM(id) {
- if (browser == 'ns4') {return document.layers[id];}
- if (browser == 'ie4') {return eval('document.all.'+ id);}
- if (browser == 'ie5') {return document.getElementById(id);}
- if (browser == 'ns6') {return document.getElementById(id);}
- if (browser == 'op5') {return document.getElementById(id);}
- return false;
- }
- function getStyle(id) {
- if (browser == 'ns4')
- {return myDOM(id);}
- if ((browser == 'ie4') || (browser == 'ie5') || (browser == 'ns6') || (browser == 'op5'))
- {return myDOM(id).style;}
- }
- var xConst=0;
- var yConst=0;
- var imageName='';
- function initName(strImgName){
- imageName = strImgName;
- }
- function initPosition() {
- imageObject = myDOM(imageName);
- if( imageObject.offsetParent ) {
- for( var posX = 0, posY = 0; imageObject.offsetParent; imageObject = imageObject.offsetParent ) {
- posX += imageObject.offsetLeft;
- posY += imageObject.offsetTop;
- }
- xConst = posX;
- yConst = posY;
- } else {
- xConst = imageObject.x;
- yConst = imageObject.y;
- }
- }
- function showMenuOn(index,inst,eventObject,flag,center,xpos,ypos) {
- eventObject.offsetParent=document;
- if (document.layers){
- tempnav = 'l_'+'subnav' + index;
- if(inst > 0){
- tempnav = 'l_'+'subnav' + index +'inst'+inst;
- }
- if(myDOM(tempnav)){
- if(flag == "true"){
- if(center == 'false'){
- getStyle(tempnav).left = eventObject.pageX;
- getStyle(tempnav).top = eventObject.pageY;
- } else {
- initPosition();
- getStyle(tempnav).left = xConst + xpos;
- getStyle(tempnav).top = yConst + ypos;
- }
- }
- getStyle(tempnav).visibility = 'show';
- }
- } else {
- tempnav = 'd_'+'subnav' + index;
- if(inst > 0){
- tempnav = 'd_'+'subnav' + index +'inst'+inst;
- }
- if(myDOM(tempnav)) {
- if(flag == "true"){
- if(center == 'false'){
- if(window.navigator.appName=="Netscape"){
- getStyle(tempnav).left = eventObject.pageX;
- getStyle(tempnav).top = eventObject.pageY;
- } else {
- getStyle(tempnav).left = eventObject.x;
- getStyle(tempnav).top = eventObject.y + document.body.scrollTop;
- }
- } else {
- initPosition();
- getStyle(tempnav).left = xConst + xpos;
- getStyle(tempnav).top = yConst + ypos;
- }
- }
- getStyle(tempnav).visibility = 'visible';
- }
- }
- }
- function showMenuOff(index,inst)
- {
- if (document.layers) {
- tempnav = 'l_'+'subnav' + index;
- if(inst > 0)
- {
- tempnav = 'l_'+'subnav' + index +'inst'+inst;
- }
- getStyle(tempnav).visibility = 'hide';
- } else {
- tempnav = 'd_'+'subnav' + index;
- if(inst > 0)
- {
- tempnav = 'd_'+'subnav' + index +'inst'+inst;
- }
- getStyle(tempnav).visibility = 'hidden';
- }
- }
- function showMenuOffNS(index,inst)
- {
- if (document.layers) {
- tempnav = 'l_'+'subnav' + index;
- if(inst > 0)
- {
- tempnav = 'l_'+'subnav' + index +'inst'+inst;
- }
- getStyle(tempnav).visibility = 'hide';
- } else if(browser == "ns6" ){
- tempnav = 'd_'+'subnav' + index;
- if(inst > 0)
- {
- tempnav = 'd_'+'subnav' + index +'inst'+inst;
- }
- getStyle(tempnav).visibility = 'hidden';
- }
- }