use*_*707 26 html javascript css jquery
我想做一些看起来像选择输入的东西但实际上不是,这里是步骤.
我做了一个<input type="text">.
我添加了一个background-image,它会显示一个"选择箭头",给人的印象是它是一个选择框.
我在此输入中添加了一个默认值.
SlideDown()当我点击它时,会有一个隐藏的div 在这个输入下面.
我尝试了只读的东西,以便无法更改值,但闪烁的光标将显示出来.
如果我使用disabled,闪烁的光标将不会显示,但jQuery中的.click()或.focus函数将无法正常工作.下拉菜单不会SlideDown().
如何在不显示闪烁光标的情况下使其可点击?
这是代码
<div style="padding-top:17px; overflow:hidden;">
    <div style="float:left;">
        <label for="secretquestion">Secret Question</label><br>
        <input type="text" class="inputselect" id="secretquestion" name="secretquestion" value="Choose a Secret Question" tabindex=10 /><br>
        <div class="selectoptions" id="secretquestionoptions">
            <b>test</b>
        </div> 
    </div>
</div>
CSS
.selectoptions
{
    display: none;
    background-color: white;  
    color: rgb(46,97,158); 
    width: 250px; 
    margin:auto; 
    border-style: solid; 
    border-width:1px; 
    border-color: rgb(46,97,158);  
    font-size: 14px; 
    text-align: center; 
}
.inputselect {
    color: white;  
    cursor: pointer;  
    background-image: url('inputselect.png');
    padding-top: 5px; 
    padding-bottom: 5px;   
    padding-left:10px; 
    padding-right:-10px;
    width:240px; 
    border-style: solid; 
    border-color: rgb(46,97,158); 
    border-width: 1px;
} 
.inputselect:hover {
    outline:none;      
    color:aqua; 
    cursor: pointer; 
    background-image: url('inputselecthover.png');
}
.inputselect:focus {
    outline:none;      
    color:aqua; 
    cursor: pointer; 
    background-image: url('inputselecthover.png');
}
Orw*_*ile 42
光标的颜色与文本的颜色相匹配.
<input type="text" style="color: transparent">
如果你真的想在输入框中显示文本(我的,有些人是有需要的),你可以使用文本阴影.
<style>
    body, div, input {
       color: #afa;
       text-shadow: 0px 0px 1px #fff;
    }
<style>
(测试过Firefox和Safari).
我只是用模糊来摆脱光标.
$('input').mousedown(function(e){
  e.preventDefault();
  $(this).blur();
  return false;
});
| 归档时间: | 
 | 
| 查看次数: | 50205 次 | 
| 最近记录: |