当前位置:起点学习辅导网培训频道电脑知识学习网页制作Javascript教程Javascrip中既是text又是select属性的输入

Javascrip中既是text又是select属性的输入

08-08 00:40:40浏览次数:814栏目:Javascript教程
标签:javascript视频教程,javascript教程下载, Javascrip中既是text又是select属性的输入,
close_dropMenu        =    是否可以关闭下拉框
dropMenuGo            =    setTimeout的变量
*/

var current_dropMenu = null
var   close_dropMenu = true
var       dropMenuGo = null

function show_dropMenu( which ){
    current_dropMenu = which                       
    if( dropMenuGo != null ){
        clearTimeout(dropMenuGo)                       
    }
        //info.innerText = which.style.script1
        eval("outSide_"+which.id).style.display = ""
        which.style.display = ""
        which.scrollTop = 0                               
        marginTop = parseInt(which.style.marginTop)       
   
    if( marginTop < -3 ){                               
        which.style.marginTop = marginTop + Math.round(( 0 - marginTop )/3)
    }else if( marginTop >= -3 && marginTop < 0 ){
        which.style.marginTop = marginTop + 1
    }
   
    if( marginTop >= 0 ){                           
        clearTimeout(dropMenuGo)
        giveItShaow(which,shadowDiv,'show')
        return
    }
   
    dropMenuGo = setTimeout("show_dropMenu( "+which.id+" )",10)    //
}
//===隐藏下拉框===
function hide_dropMenu(){
    if( current_dropMenu != null ){               
        if( close_dropMenu ){
            clearTimeout(dropMenuGo)
            current_dropMenu.style.display = "none"
            eval("outSide_"+current_dropMenu.id).style.display = "none"
            current_dropMenu.style.marginTop = current_dropMenu.parentNode.offsetHeight*(-1)
            giveItShaow(current_dropMenu,shadowDiv,'hide')
        }
    }
}

//===选择下拉框的值===
function choose_dropMenu( which , self ){
        close_dropMenu = true
        hide_dropMenu()
        //eval(which).document.body.innerText = self.innerText.substr(0,self.innerText.length-1)
        eval(which).value = self.innerText
}
//===除前后空格===
function trim(str){
    if( str.substr(0,1)==" "){
        str = str.substr(1)
    }
    if( str.substr(str.length-1,1)==" "){
        str = str.substr(0,str.length-2)
    }
    return str
}


function replaceFilters( str ){                   
    //str = str.replace(/ /g,"")
    str = trim(str)
    str = str.replace(/=/g,':')
    str = str.replace(/:/g,':"')
    str = str.replace(/  /g,' ')
    str = str.replace(/:"///g,'://')
    str = str.replace(/javascript:"/g,'javascript:')
    str = str.replace(/,/g,'",')
    str = str + '"'
    str = str.replace(/""/g,'"')
    str = "{" + str + "}"
    return str
}


/*
type                =    变量名称
defaultVariables    =    默认的值(不能为空)
*/
function setFilters( type , defaultVariables ){
    if( filters[type] == undefined ){               
        if( defaultVariables == undefined ){
            defaultVariables = ""
        }
        eval( type + "=defaultVariables" )
    }else{
        eval( type + "=filters[type]" )
    }
}


        var getStr , cTmpStr
        function Separate_Str(){
            getStr = ""
            for ( i = 0; i < cTmpStr.length ; i ++ ){

上一页  [1] [2] [3] [4]  下一页

,Javascrip中既是text又是select属性的输入
给资讯打分:
网友评论: