el-select下拉框样式结合el-table(伪)结合下拉选择

示例

请添加图片描述

使用

# ------------------------使用---------------------------------------
<drop-down-selector v-model="value" :options="{placeholder:'单位名称',disabled: false,multiple: true,selection:true,key:'id',label: 'name',clearable: true,collapseTags: 5}" :request-fun="getList" :showField="[{prop:'name',label: '名称',width: '200'},{prop: 'sex',label: '性别'}]" :returnField="['id','name']" :page-option="{pageSizes: [1,2,3,4,5]}"></drop-down-selector>


组件 --------------drop-down-selector.vue------------

<!-- 下拉选择器组件分装 -->
<template>
  <div>
    <!-- :hide-on-click="!allOptions.multiple"  -->
    
    <el-dropdown class="drop_down_input" ref="selectDown" :class="[allOptions.size == 'mini'? 'el-input--mini':(allOptions.size == 'small'?'el-input--small':'el-input--medium')]" trigger="click" :disabled="allOptions.disabled || false" :placement="allOptions.placement || 'bottom-start'" @visible-change="toggleClick">
      <!-- 选择框 -->
      <div class=" el-input__inner select_wrap" :class="{clearBtn: multipleSelection.length > 0}">
        <div class="input_left"></div>
        <div class="input_center" :class="{'margin_right_position': allOptions.collapseTags && multipleSelection.length > allOptions.collapseTags}">
          <template v-if="allOptions.collapseTags">
            <el-tag v-for="(item,index) in multipleSelection.filter((it,idx) => {return idx < parseInt(allOptions.collapseTags)})" :key="index" closable type="danger" style="margin-right: 5px" @close="colseSelectItem(item,index)"> {{item[allOptions.label]}}</el-tag>
          </template>
          <template v-else>
            <el-tag v-for="(item,index) in multipleSelection" :key="index" closable type="danger" style="margin-right: 5px" @close="colseSelectItem(item,index)"> {{item[allOptions.label]}} </el-tag>
          </template>
        </div>
        <el-tag style="margin-right: 25px" v-if="allOptions.collapseTags && multipleSelection.length > allOptions.collapseTags">{{multipleSelection.length < 99? `+${multipleSelection.length}`: `99+`}}</el-tag>
        <div class="el-input__suffix el-input__suffix-inner el-input__icon el-icon-arrow-down" :class="{'rotate_right': dropDownStatus}" @click.stop="clearAllSelect"></div>
      </div>
      <!-- 下拉框 -->
      <el-dropdown-menu slot="dropdown" class="drop_down_box">
        <el-row class="search_box">
          <el-input :size="allOptions.size" v-model="keyword" :placeholder="`请输入${allOptions.placeholder || ''}`" @keydown.enter.native.stop="searchClick"></el-input>
          <el-button type="primary" @click="searchClick">搜 索</el-button>
          <el-button type="success">清 空</el-button>
        </el-row>
        <el-row>
          <u-table :row-key="allOptions.key" :row-id="allOptions.key" :size="allOptions.size || 'mini'" ref="multipleTable" :height="initTableHeight" :data="tableData" :stripe="allOptions.stripe || true" :border="allOptions.border || true" :tooltip-effect="allOptions.tooltipEffect || 'dark'" style="width: 100%" selectTrClass="selectTr" :record-table-select="true" @selection-change="handleSelectionChange" @row-click="selectRow" :pagination-show="true" :total="allPage.total" :page-size="allPage.pageSize" :current-page="allPage.currentPage" :page-sizes="allPage.pageSizes ||[10,20,50,100,200,500]" @handlePageSize="handlePageSize">
            <template slot="empty">
              <el-empty description="暂无数据" :image-size="100" class="table_empty"></el-empty>
            </template>
            <u-table-column :reserve-selection="true" v-if="allOptions.multiple || false" type="selection" fixed></u-table-column>
            <u-table-column v-for="(item,index) in showField" :key="index" :prop="item.prop" :label="item.label" :width="item.width" :show-overflow-tooltip="true" :fixed="item.fixed || false"></u-table-column>
          </u-table>
        </el-row>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
import { Input } from 'element-ui'

/**
 * requestFun    Function请求函数
 * options = {
 *  collapseTags String| number 是否折叠标签
 *  formatKey:   String  绑定key 的方法  Array 或 String
 *  key:         string  绑定的key
 *  label:         string  绑定的label
 *  placeholder: string  提示语句
 *  clearable    Boolean 是否显示清除按钮
 *  multiple:    Boolean 是否多选,关联是否点击下拉框就隐藏属性
 *  disabled:    Boolean 是否禁用 默认 false
 *  placement:   string  菜单弹出位置 默认 bottom-start
 *  search:      Object  搜索条件 
 *  size:        string  输入框尺寸 默认mini
 * }
 * searchOption = {
 *  prop:       String 收索的字段
 *  label:      string 收索的字段名称
 *  placeholder String 提示
 * }
 * showField =[ Array 展示字段
 *  {prop:'',label: '',width:''},
 * ]
 *  returnField = ['id','name'] 设置返回的 字段对象 如 返回  {id: [1,2,3],name: ['qwe','asd','zxc'],its:[{id: 1,name: 'qwe'},{id: 2,name: 'asd'},{id: 3,name: 'zxc'}]}
 *  pageOption  Object 分页配置 :page-option="{total: page.total, pageSize: page.page.Size, currentPage: page.currentPage}"
 * 
 */
export default {
  props: {
    value: { type: String | Array, request: true }, //双向绑定属性
    options: { type: Object, default() { return {} } },
    requestFun: { type: Function },
    showField: { type: Array, request: true },
    returnField: { type: Array, default() { return [] } },
    pageOption: { type: Object, default() { return { total: 0, currentPage: 1, pageSize: 20 }}}
  },
  watch: {
    value: {
      handler(newValue, oldValue) {
        console.log(newValue, 'newValue')
        if (!newValue) return
        newValue = this.conversionValue(newValue)// 转成字符串数组
        // this.requestFun()
        this.formateSelectData(newValue)//初始化默认选中的数据
        this.returnData()
      },
      deep: true,
      immediate: true
    }
  },
  computed: {
    allOptions() {
      return { size: 'mini', formatKey: 'String', ...this.options }
    },
    allPage() {
      return {...this.page,...this.pageOption}
    }
  },
  data() {
    return {
      table_height: '',
      dropDownStatus: false,
      keyword: "", //收索条件
      showcolumn: "", //要显示的列
      search: {}, //
      tableData: [{ id: 1, name: "张三", sex: "男" }, { id: 2, name: "李四", sex: "女" }],
      tableData1: [{ id: 1, name: "张三", sex: "男" }, { id: 2, name: "李四", sex: "女" }, { id: 5, name: "张三", sex: "男" }, { id: 6, name: "张三", sex: "男" },],
      tableData2: [{ id: 3, name: "3", sex: "女" }, { id: 4, name: "4", sex: "女" }, { id: 7, name: "张三", sex: "男" }, { id: 8, name: "张三", sex: "男" },],
      page: {//分页
        total: 8,
        currentPage: 1,
        pageSize: 2,

      },
      initTableHeight: 0,
      //多选
      multipleSelection: []
    }
  },
  methods: {
    //字符数组 字符串  转换成 字符串数组
    conversionValue(value) {
      if (typeof value == 'string') {//字符串的形式
        value = value.split(',')
      }
      return value.map(item => { return String(item) })
    },

    //点击某行
    selectRow(row, column, event) {
      if (!this.allOptions.multiple) return;
      console.log('点击某行', row, column, event)
      this.$refs.multipleTable.toggleRowSelection([{ row: row }])//切换选中

    },
    //选中监听事件
    handleSelectionChange(val) {
      console.log('监听事件多选返回子项对象数组:', val, this.allOptions)
      this.multipleSelection = val;
      let arr = this.multipleSelection.map(item => item[this.allOptions.key])
      this.allOptions.formatKey == 'String' ? this.$emit('input', arr.join(',')) : this.$emit('input', arr)
    },
    //处理返回的数据
    returnData() {
      if (!this.returnField.length) return { its: this.multipleSelection }
      let obj = {}
      this.returnField.forEach(item => {
        this.multipleSelection.forEach(it => {
          if (obj[item]) {
            obj[item].push(it[item])
          } else {
            obj[item] = [it[item]]
          }
        })
      })
      obj.its = this.multipleSelection
      console.log('处理返回的数据', obj)
    },


    //切换下拉显示隐藏
    async toggleClick(value) {//显示true,隐藏false
      this.dropDownStatus = value
      console.log(value)
      // if (value) {
      //   let tableData = await this.requestFun()
      // } else {

      // }

    },
    //初始化默认选中的数据
    formateSelectData(value) {
      console.log('初始化默认选中的数据', value)
      this.$nextTick(() => {
        let arr = []
        this.tableData.forEach(item => {
          if (value.includes(String(item[this.allOptions.key]))) {
            arr.push({ row: item, selected: true })
          }
        })
        this.$refs.multipleTable.toggleRowSelection(arr)
      })
    },
    //清除全部选中的数据
    clearAllSelect($event) {
      let arr = this.multipleSelection.map(item => { return { row: item, selected: false } })
      this.$refs.multipleTable.toggleRowSelection(arr)
    },
    //关闭选中的标签
    colseSelectItem(item, index) {
      console.log('关闭选中的标签', item, index)
      this.multipleSelection.forEach(it => {
        if (it[this.allOptions.key] == item[this.allOptions.key]) {
          this.$refs.multipleTable.toggleRowSelection([{ row: it, selected: false }])
        }
      })
    },
    //搜索 查询
    searchClick($event) {
      console.log('搜索按钮点击事件: searchClick',';搜索条件值:',this.keyword)
      $event.preventDefault()
      this.$emit('searchClick', this.keyword)
    },
    // 分页事件
    handlePageSize({size, page}) {
      console.log('触发的分页事件:handlePageSize;','传入的参数:',{size, page})
      this.$emit('handlePageSize',{size, page})
      this.page.currentPage = page
      this.page.pageSize = size
      if (page == 1) {
        this.tableData = this.tableData1
      } else {
        this.tableData = this.tableData2
      }
      this.$refs.selectDown.show()
      console.log('分页变化:', page)
    },
    //清空搜索条件
    resetClick() {
      this.query = {}
      this.onLoad()
    },
    // initTableHeight() { this.$nextTick(() => {return 300}) }
  },
  created() { },
  mounted() {
    setTimeout(() => {
      this.initTableHeight = 300
      // console.log(this.$refs.multipleTable.setHeight, 'this.$refs.multipleTable.setHeight')
    }, 500);
  },
}
</script>

<style scoped lang="scss">
//输入框样式
.drop_down_input {
  width: 100%;
  cursor: pointer;

  &:hover {
  }
  .mini {
    height: 28px;
  }
  .select_wrap {
    padding: 3px;
    display: flex;
    align-items: center;
    &.clearBtn:hover {
      .el-icon-arrow-down::before {
        content: "\e78d";
      }
    }
    .input_left {
    }
    .input_center {
      &.margin_right_position {margin-right: 3px;}
      flex: 1;
      margin-right: 25px;
      scrollbar-width: none;
      -ms-overflow-style: none;
      line-height: 1.5;
      white-space: nowrap;
      overflow: auto;
    }
    .rotate_right {
      transform: rotate(-180deg);
    }
  }
}
::-webkit-scrollbar {
  display: none; /* Chrome Safari */
}

//size 样式
// .el-input--mini .el-input__inner{}

// 下拉框样式
.drop_down_box {
  padding: 0px;
  min-width: 300px;
  .el-button {
    width: unset !important;
  }
  .search_box {
    display: flex;
    .el-button {
      margin: 0;
    }
  }
}

// table 样式
/deep/ .avue-crud__menu {
  display: none;
}

// 无数据
.table_empty {
  padding: 0;
}
/deep/.el-table__empty-block {
  // align-content: center;
  height: 100%;
}
</style>
<style>
/* 选中样式 */
.selectTr td {
  background: #d5e4f4 !important;
}
/* 分页 */
.myPagination {
  padding: 0 !important;
}
</style>

配置

/**
 * requestFun    Function请求函数
 * options = {
 *  collapseTags String| number 是否折叠标签
 *  formatKey:   String  绑定key 的方法  Array 或 String
 *  key:         string  绑定的key
 *  label:         string  绑定的label
 *  placeholder: string  提示语句
 *  clearable    Boolean 是否显示清除按钮
 *  multiple:    Boolean 是否多选,关联是否点击下拉框就隐藏属性
 *  disabled:    Boolean 是否禁用 默认 false
 *  placement:   string  菜单弹出位置 默认 bottom-start
 *  search:      Object  搜索条件 
 *  size:        string  输入框尺寸 默认mini
 * }
 * searchOption = {
 *  prop:       String 收索的字段
 *  label:      string 收索的字段名称
 *  placeholder String 提示
 * }
 * showField =[ Array 展示字段
 *  {prop:'',label: '',width:''},
 * ]
 *  returnField = ['id','name'] 设置返回的 字段对象 如 返回  {id: [1,2,3],name: ['qwe','asd','zxc'],its:[{id: 1,name: 'qwe'},{id: 2,name: 'asd'},{id: 3,name: 'zxc'}]}
 *  pageOption  Object 分页配置 :page-option="{total: page.total, pageSize: page.page.Size, currentPage: page.currentPage}"
 * 
 */
[removed] // ViaSelect Environment Constants var SS_ENV = new Object(); SS_ENV.IE_Version = new Number(((window.navigator.appVersion.split('; '))[1].split(' '))[1]); SS_ENV.CR = new Object(); SS_ENV.CR.ReverseBackground = '#E2519C'; SS_ENV.CR.ReverseText = 'white'; SS_ENV.CR.Border = '#D55C9A'; SS_ENV.CR.BorderActive = '#FF6CB7'; SS_ENV.DefaultHeight = 20; SS_ENV.ButtonWidth = 13; SS_ENV.OptionsDivStyle = '' + ' display:none;' + ' z-index:10;' + ' position:absolute;' + ' border:1 solid '+ SS_ENV.CR.Border+';' + ' background-color:white;' + ' scrollbar-face-color:#D4D0C8;' + ' scrollbar-shadow-color:white;' + ' scrollbar-highlight-color:#F6F5F4;' + ' scrollbar-3dlight-color:white' + ' scrollbar-darkshadow-color:#86837E;' + ' scrollbar-track-color:#F6F5F4;' + ' scrollbar-arrow-color:#86837E;'; SS_ENV.OptionNobrStyle = '' + ' font-size:12px;' + ' font-family:奔覆;'; // SaySelect Variables var SS_VAR = new Object(); SS_VAR.DivDummy = document.createElement("DIV"); SS_VAR.SelectList = new Array(); SS_VAR.bEventAttached = false; var SS_CreatedElements = new Object(); function unloadObjects() { try { if (SS_VAR && SS_VAR.SelectList) { for (key in SS_VAR.SelectList) { if (SS_VAR.SelectList[key]) { try { SS_VAR.SelectList[key].select.setAttribute('SS', 0); } catch (e) {}; delete SS_VAR.SelectList[key]; } } } } catch (e) {}; } attachEvent("onunload", unloadObjects); function SS_create (srcHTML, ListMax, bAutoDetect) { // property this.ssID = SS_VAR.SelectList.length; this.bOriginalSelect = (bAutoDetect && SS_ENV.IE_Version < 5.5); this.select = SS_createElement(srcHTML); this.selectedIndex = this.select.selectedIndex; this.options = this.select.options; this.width = parseInt(this.select.style.width); this.height = (this.select.style.height) ? parseInt(this.select.style.height) : SS_ENV.DefaultHeight; this.OptionHeight = this.height - 4; this.bListDown = (ListMax && '-'==ListMax.toString().substr(0, 1)) ? false : true; this.ListMax = (!isNaN(parseInt(ListMax))) ? Math.abs(ListMax) : 100; this.Table; this.TitleDiv; this.TitleTable; this.TitleWrapper; this.OptionsDiv; this.OptionsWrapper; this.OptionsTable; this.bFocused = false; this.bExpanded = false; this.bReverse = false; // private method this.isThisEventToBeCanceled = SS_isThisEventToBeCanceled; this.toggleTitle = SS_toggleTitle; this.syncSelectedIndex = SS_syncSelectedIndex; this.toggleOptions = SS_toggleOptions; this.turnOnOption = SS_turnOnOption; this.turnOffOption = SS_turnOffOption; this.handleMousewheel = SS_handleMousewheel; this.handleOverTitle = SS_handleOverTitle; this.handleOutTitle = SS_handleOutTitle; this.handleOverOption = SS_handleOverOption; this.createTable = SS_createTable; this.createTitleDiv = SS_createTitleDiv; this.createOptionsDiv = SS_createOptionsDiv; this.createOptionTr = SS_createOptionTr; this.adjustOptionsDiv = SS_adjustOptionsDiv; this.syncOptions = SS_syncOptions; this.pressOption = SS_pressOption; this.moveOption = SS_moveOption; this.releaseOption = SS_releaseOption; this.pressTitle = SS_pressTitle; this.releaseTitle = SS_releaseTitle; // public method this.display = SS_display; this.insertOption = SS_insertOption; this.deleteOption = SS_deleteOption; this.changeOption = SS_changeOption; // initiate this.createTable(); this.select.setAttribute('SS', this); if (!this.bOriginalSelect) this.select. SS_VAR.SelectList[this.ssID] = this; } function SS_display () { [removed]("<div id=SS_TempDiv></div>\n"); document.all.SS_TempDiv.appendChild(this.Table); document.all.SS_TempDiv.removeNode(); } function SS_write (srcHTML, ListMax, bAutoDetect) { var oSS = new SS_create(srcHTML, ListMax, bAutoDetect); oSS.display(); return oSS; } function SS_insertOption (value, innerText, idx) { var NewOption = document.createElement("OPTION"); SS_CreatedElements[SS_CreatedElements.length] = NewOption; this.options.add(NewOption, idx); NewOption.innerText = innerText; NewOption.value = value; if (!this.bOriginalSelect) this.createOptionTr(idx); this.syncOptions(); this.adjustOptionsDiv(); this.syncSelectedIndex(); } function SS_deleteOption (idx) { this.options.remove(idx); if (!this.bOriginalSelect) this.OptionsTable.deleteRow(idx); this.syncOptions(); this.adjustOptionsDiv(); this.syncSelectedIndex(); } function SS_changeOption (idx, value, innerText) { this.options[idx].value = value; this.options[idx].innerText = innerText; this.syncOptions(); this.syncSelectedIndex(); } function SS_cancelEvent (event) { event.cancelBubble = true; event.returnValue = false; } function SS_isThisEventToBeCanceled (event) { if ('object' == typeof(event)) { switch (event.type) { case 'mousedown': if (!(event.button & 1)) return true; break; case 'mouseup': if (!(event.button & 1)) return true; if (SS_ENV.IE_Version >= 5.5 && event.srcElement != this.srcElementOfLastMousedown && this.srcElementOfLastMousedown != null) { this.srcElementOfLastMousedown = null; return true; } break; case 'mouseout': if (!(SS_ENV.IE_Version < 5.5 && event.srcElement == this.srcElementOfLastMousedown)) return true; break; case 'mousemove': if (SS_ENV.IE_Version >= 5.5 && event.srcElement != this.srcElementOfLastMousedown && this.srcElementOfLastMousedown != null) return true; break; } } return false; } function SS_createElement (html) { SS_VAR.DivDummy.insertAdjacentHTML('afterBegin', html); var oEl = SS_VAR.DivDummy.children(0); while (SS_VAR.DivDummy.children.length > 0) { SS_VAR.DivDummy.removeChild(SS_VAR.DivDummy.children(0)); } return oEl; } function SS_blurExcept (except) { SS_cancelEvent(window.event); except = ('number'==typeof(except)) ? except : -1; var bHasToDetachEvent = true; for (var i=0; i < SS_VAR.SelectList.length; i++) { if (-1==except && SS_VAR.SelectList[i].bFocused && SS_VAR.SelectList[i].bExpanded) { SS_VAR.SelectList[i].toggleOptions(false, true); SS_VAR.SelectList[i].toggleTitle(true); bHasToDetachEvent = false; } else if (i!=except) { if (SS_VAR.SelectList[i].bExpanded) SS_VAR.SelectList[i].toggleOptions(false, true); if (SS_VAR.SelectList[i].bReverse) SS_VAR.SelectList[i].toggleTitle(false); SS_VAR.SelectList[i].bFocused = false; } } if (SS_VAR.bEventAttached && bHasToDetachEvent) { document.detachEvent('onmousedown', SS_blurExcept); document.detachEvent('ondblclick', SS_blurExcept); SS_VAR.bEventAttached = false; } } function SS_syncSelectedIndex () { this.selectedIndex = this.select.selectedIndex; if (this.bOriginalSelect) return; if (this.TitleTable.cells(0).childNodes(0).innerText != this.options[this.selectedIndex].innerText) this.TitleTable.cells(0).childNodes(0).innerText = this.options[this.selectedIndex].innerText; if (this.bExpanded) this.toggleOptions(false); } function SS_toggleTitle (bReverse) { this.bReverse = ('undefined'!=typeof(bReverse)) ? bReverse: (!this.bReverse); this.TitleTable.cells(0).style.backgroundColor = this.bReverse ? SS_ENV.CR.ReverseBackground : ''; this.TitleTable.cells(0).style.color = this.bReverse ? SS_ENV.CR.ReverseText : ''; } function SS_toggleOptions (bExpanded, bStrict) { if (!bStrict && !this.bFocused) { SS_blurExcept(this.ssID); } this.bExpanded = ('undefined'!=typeof(bExpanded)) ? bExpanded: (!this.bExpanded); if (this.bExpanded) { this.adjustOptionsDiv(); this.OptionsDiv.style.display = 'block'; if (!bStrict) { this.toggleTitle(false); this.handleOverOption(this.selectedIndex); } this.handleOutTitle(); } else { this.OptionsDiv.style.display = 'none'; if (!bStrict) { this.toggleTitle(true); } } if (!bStrict) { this.bFocused = true; if (!SS_VAR.bEventAttached) { document.attachEvent('onmousedown', SS_blurExcept); document.attachEvent('ondblclick', SS_blurExcept); SS_VAR.bEventAttached = true; } } } function SS_handlePropertychange () { if ('propertychange'==window.event.type && 'selectedIndex'==window.event.propertyName) { var oSS = window.event.srcElement.SS; oSS.syncSelectedIndex(); if (null != oSS.select.onchange) oSS.select.onchange(); } } function SS_handleMousewheel (event) { var idx = this.selectedIndex; if ('mousewheel'==event.type && this.bFocused && this.bReverse) { for (var i=0; i < event.wheelDelta; i += 120) idx--; for (var i=0; i > event.wheelDelta; i -= 120) idx++; } idx = Math.max(idx, 0); idx = Math.min(idx, this.options.length - 1); this.select.selectedIndex = idx; } function SS_handleOverTitle () { if (this.bExpanded) return; this.TitleTable.style.borderColor = SS_ENV.CR.BorderActive; this.TitleTable.cells(1).style.display = 'none'; this.TitleTable.cells(2).style.display = 'block'; } function SS_handleOutTitle () { this.TitleTable.style.borderColor = SS_ENV.CR.Border; this.TitleTable.cells(2).style.display = 'none'; this.TitleTable.cells(1).style.display = 'block'; } function SS_handleOverOption (idx) { for (var i=0; i < this.options.length; i++) { if (i==idx) this.turnOnOption(i); else this.turnOffOption(i); } } function SS_turnOnOption (idx) { this.OptionsTable.cells(idx).style.color = SS_ENV.CR.ReverseText; this.OptionsTable.cells(idx).style.backgroundColor = SS_ENV.CR.ReverseBackground; } function SS_turnOffOption (idx) { this.OptionsTable.cells(idx).style.color = ''; this.OptionsTable.cells(idx).style.backgroundColor = ''; } function SS_adjustOptionsDiv () { if (this.bOriginalSelect) return; this.OptionsDiv.style.width = this.width; this.OptionsDiv.style.height = Math.min(this.options.length, this.ListMax) * this.OptionHeight + 2; this.OptionsWrapper.style.height = this.options.length * this.OptionHeight; this.OptionsDiv.style.overflowY = (this.options.length > this.ListMax) ? 'scroll' : ''; var top = this.Table.offsetTop; var left = this.Table.offsetLeft; for (var El = this.Table.offsetParent; 'BODY'!=El.tagName && 'absolute'!=El.style.position && 'relative'!=El.style.position; El = El.offsetParent) { if ('TABLE' != El.tagName) { top += El.clientTop; left += El.clientLeft; } top += El.offsetTop; left += El.offsetLeft; } this.OptionsDiv.style.top = (this.bListDown) ? (top + this.height) : (top - parseInt(this.OptionsDiv.style.height)); this.OptionsDiv.style.left = left; this.TitleWrapper.style.top = 0; this.TitleWrapper.style.left = 0; } function SS_syncOptions () { if (this.bOriginalSelect) return; for (var i=0; i < this.options.length; i++) { this.OptionsTable.cells(i).setAttribute('index', i); if (this.OptionsTable.cells(i).childNodes(0).innerText != this.options[i].innerText) this.OptionsTable.cells(i).childNodes(0).innerText = this.options[i].innerText; } } function SS_pressTitle (event) { SS_cancelEvent(event); this.srcElementOfLastMousedown = event.srcElement; this.toggleOptions(); } function SS_releaseTitle (event) { SS_cancelEvent(event); if (this.isThisEventToBeCanceled(event)) return; this.srcElementOfLastMousedown = null; } function SS_pressOption (event) { SS_cancelEvent(event); this.srcElementOfLastMousedown = event.srcElement; } function SS_moveOption (event) { SS_cancelEvent(event); if (this.isThisEventToBeCanceled(event)) return; if (!(event.offsetX >= 0 && event.offsetX <= this.OptionsTable.offsetWidth)) return; this.handleOverOption(Math.floor(event.offsetY / this.OptionHeight)); } function SS_releaseOption (event) { SS_cancelEvent(event); if (this.isThisEventToBeCanceled(event)) return; this.srcElementOfLastMousedown = null; if (event.offsetX >= 0 && event.offsetX <= this.OptionsTable.offsetWidth) { this.toggleOptions(false); this.select.selectedIndex = Math.floor(event.offsetY / this.OptionHeight); } } function SS_createTable () { this.Table = SS_createElement("" + "<table border=0 cellpadding=0 cellspacing=0 cursor:default'>" + "<tr><td></td></tr>" + "</table>" ); if (!isNaN(this.width)) this.Table.style.width = this.width; this.Table.style.height = this.height; if (!this.bOriginalSelect) { this.createTitleDiv(); this.createOptionsDiv(); this.Table.cells(0).appendChild(this.TitleDiv); this.Table.cells(0).appendChild(this.OptionsDiv); } else { this.Table.cells(0).appendChild(this.select); } } function SS_createTitleDiv () { this.TitleDiv = SS_createElement("" + "<div top:0; left:0;'>" + " <table border=0 cellpadding=0 cellspacing=1" + " height="+this.height + " bgcolor=white" + " border:1 solid "+SS_ENV.CR.Border+";'" + " + " >" + " <tr>" + " <td><nobr + " <td width="+SS_ENV.ButtonWidth+" align=center + " <td width="+SS_ENV.ButtonWidth+" align=center + " <td ></td>" + " </tr>" + " </table>" + "</div>" ); this.TitleTable = this.TitleDiv.childNodes(0); this.TitleTable.cells(0).childNodes(0).innerText = this.options[this.selectedIndex].innerText; this.TitleTable.cells(1)[removed] = "<img src='btn_down.gif'>"; this.TitleTable.cells(2)[removed] = "<img src='btn_down_s.gif'>"; this.TitleTable.cells(3).appendChild(this.select); this.TitleWrapper = document.createElement("" + "<img SS_VAR.SelectList["+this.ssID+"].releaseTitle(window.event);' ); SS_CreatedElements[SS_CreatedElements.length] = this.TitleWrapper; this.TitleDiv.appendChild(this.TitleWrapper); } function SS_createOptionsDiv () { this.OptionsDiv = SS_createElement("" + "<div + " + " + ">" + " <table border=0 cellpadding=0 cellspacing=0 width=100% + " </table>" + "</div>" ); this.OptionsTable = this.OptionsDiv.childNodes(0); for (var i=0; i < this.options.length; i++) { this.createOptionTr(i); } this.syncOptions(); this.OptionsWrapper = document.createElement("" + "<img ); SS_CreatedElements[SS_CreatedElements.length] = this.OptionsWrapper; this.OptionsDiv.appendChild(this.OptionsWrapper); } function SS_createOptionTr (idx) { idx = ('undefined'!=typeof(idx)) ? idx : this.options.length - 1; var OptionTr = this.OptionsTable.insertRow(-1); var OptionTd = document.createElement("<td height="+this.OptionHeight+"></td>"); SS_CreatedElements[SS_CreatedElements.length] = this.OptionsTd; OptionTd.appendChild(document.createElement("<nobr OptionTr.appendChild(OptionTd); } [removed] </head> <body>[removed]SS_write("<select name=star>\n" +" <option value=\"\" selected>不限</option>\n" +"<option value=\"水瓶座\">水瓶座</option>" +"<option value=\"双鱼座\">双鱼座</option>" +"<option value=\"白羊座\">白羊座</option>" +"<option value=\"金牛座\">金牛座</option>" +"<option value=\"双子座\">双子座</option>" +"<option value=\"巨蟹座\">巨蟹座</option>" +"<option value=\"狮子座\">狮子座</option>" +"<option value=\"处女座\">处女座</option>" +"<option value=\"天秤座\">天秤座</option>" +"<option value=\"天蝎座\">天蝎座</option>" +"<option value=\"射手座\">射手座</option>" +"<option value=\"摩羯座\">摩羯座</option>" +"</select>\n"); [removed] <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td>[removed]SS_write("<select name='province' >\n" +"<option value=\"\" selected>都行</option>\n" +"<option value=\"北京\">北京</option>" +"<option value=\"上海\">上海</option>" +"<option value=\"天津\">天津</option>" +"<option value=\"重庆\">重庆</option>" +"<option value=\"安徽\">安徽</option>" +"<option value=\"福建\">福建</option>" +"<option value=\"甘肃\">甘肃</option>" +"<option value=\"广东\">广东</option>" +"<option value=\"广西\">广西</option>" +"<option value=\"贵州\">贵州</option>" +"<option value=\"海南\">海南</option>" +"<option value=\"河北\">河北</option>" +"<option value=\"黑龙江\">黑龙江</option>" +"<option value=\"河南\">河南</option>" +"<option value=\"湖北\">湖北</option>" +"<option value=\"湖南\">湖南</option>" +"<option value=\"内蒙古\">内蒙古</option>" +"<option value=\"江苏\">江苏</option>" +"<option value=\"江西\">江西</option>" +"<option value=\"吉林\">吉林</option>" +"<option value=\"辽宁\">辽宁</option>" +"<option value=\"宁夏\">宁夏</option>" +"<option value=\"青海\">青海</option>" +"<option value=\"山西\">山西</option>" +"<option value=\"陕西\">陕西</option>" +"<option value=\"山东\">山东</option>" +"<option value=\"四川\">四川</option>" +"<option value=\"江西\">江西</option>" +"<option value=\"西藏\">西藏</option>" +"<option value=\"新疆\">新疆</option>" +"<option value=\"云南\">云南</option>" +"<option value=\"浙江\">浙江</option>" +"<option value=\"其它\">其它</option>" +"</select>\n",8); [removed]</td> </tr> </table> <br>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

RxnNing

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值