select 宽度如何保持各浏览器一致,保持与TEXT一样长。

szjarvis 2014-09-01 02:04:31
<input type="text" size="50" />
<select style="width:300px;">

这样在IE9下是一样长的,但在其它浏览器,或IE其它版本上就不一样长了,如何设置?
...全文
269 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
___紫菜 2014-09-03
  • 打赏
  • 举报
回复

-moz代表firefox浏览器私有属性
-ms代表IE浏览器私有属性
-webkit代表chrome、safari私有属性
___紫菜 2014-09-03
  • 打赏
  • 举报
回复

<script type=“text/javascript”>

      function isIE(){
          return navigator.appName.indexOf(“Microsoft Internet Explorer”)!=-1 && document.all;
      }

      function isIE6() {
          return navigator.userAgent.split(“;”)[1].toLowerCase().indexOf(“msie 6.0″)==“-1″?false:true;
      }

      function isIE7(){
          return navigator.userAgent.split(“;”)[1].toLowerCase().indexOf(“msie 7.0″)==“-1″?false:true;
      }

      function isIE8(){
          return navigator.userAgent.split(“;”)[1].toLowerCase().indexOf(“msie 8.0″)==“-1″?false:true;
      }

      function isNN(){
         return navigator.userAgent.indexOf(“Netscape”)!=-1;
      }

      function isOpera(){
          return navigator.appName.indexOf(“Opera”)!=-1;
      }

      function isFF(){
          return navigator.userAgent.indexOf(“Firefox”)!=-1;
      }

      function isChrome(){
          return navigator.userAgent.indexOf(“Chrome”) > -1;
      }
 </script>
szjarvis 2014-09-01
  • 打赏
  • 举报
回复
有没有现成的参考一下。
javascript_2011 2014-09-01
  • 打赏
  • 举报
回复
js先判断浏览器,在设置长度 一般情况下会根据浏览器不同写css

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧