在网页头部定义js代码

<script type="text/javascript">
function gradeChange(e){
var selectId = document.getElementById("selectId");
var index = selectId.selectedIndex;
var value = selectId.options[index].value;
var id = selectId.options[index].id;
document.getElementById(id).setAttribute('disabled','disabled');
var ul = document.getElementById("ul");
var li = document.createElement("li");
li.setAttribute('id','li_'+id);
li.setAttribute('onclick','del('+id+')');
var span = document.createElement("span");
span.innerHTML =value+'×';
li.appendChild(span);
ul.appendChild(li);
selectId[].selected = true;
var hide = document.getElementById("hotTagName");
if(hide.value=='' || hide.value=="null"){
hide.setAttribute('value',value);
}else{
hide.setAttribute('value',hide.value+','+value);
}
}
</script>
<body> 
<select style="float:left;" id="selectId" onchange="javascript:gradeChange(this);">
<option value="">--热点标签--</option>
<logic:notEmpty name="tagList">
<logic:iterate id="tag" name="tagList" indexId="i">
<option id="id_${i}" value ="${tag.name}">${tag.name}</option>
</logic:iterate>
</logic:notEmpty>
</select>
<body>

IE、360报错gradeChange方法未定义,不兼容问题谷歌、火狐正常。

经过考虑之后把代码定义在 <BODY>里,打开页面默认加载js方法

全部兼容了

<body>
<select style="float:left;" id="selectId" onchange="javascript:gradeChange(this);">
<option value="">--热点标签--</option>
<logic:notEmpty name="tagList">
<logic:iterate id="tag" name="tagList" indexId="i">
<option id="id_${i}" value ="${tag.name}">${tag.name}</option>
</logic:iterate>
</logic:notEmpty>
</select>
<script>
function gradeChange(e){
var selectId = document.getElementById("selectId");
var index = selectId.selectedIndex;
var value = selectId.options[index].value;
var id = selectId.options[index].id;
document.getElementById(id).setAttribute('disabled','disabled');
var ul = document.getElementById("ul");
var li = document.createElement("li");
li.setAttribute('id','li_'+id);
li.setAttribute('onclick','del('+id+')');
var span = document.createElement("span");
span.innerHTML =value+'×';
li.appendChild(span);
ul.appendChild(li);
selectId[].selected = true;
var hide = document.getElementById("hotTagName");
if(hide.value=='' || hide.value=="null"){
hide.setAttribute('value',","+value);
}else{
hide.setAttribute('value',hide.value+','+value);
}
}
</script>
</body>

IE、360浏览器select属性onchange遇到的坑的更多相关文章

  1. 兼容ie[6-9]、火狐、Chrome、opera、maxthon3、360浏览器的js本地图片预览

    html代码: <div id="divPreview"> <img id="imgHeadPhoto" src="Images/H ...

  2. 浏览器 私有属性&内核

    -moz代表firefox浏览器私有属性 -ms代表IE浏览器私有属性 -webkit代表chrome.safari私有属性 IE使用的是Trident内核,Firefox 使用的是Gecko内核.目 ...

  3. css解决谷歌,360浏览器默认最小字体为12px问题

    当我们设置前台html页面样式问题字体小于12px;时,会发现不管怎么设置小于12px字体,在谷歌.360浏览器上都不生效. 但在火狐等浏览器上却可以正常设置,当你打开谷歌360的设置后会发现,它们设 ...

  4. select的onChange事件问题解决

    一.onChange事件只有在值改变时才可触发,所以必须在每一次选择时(尤其第一次)保证选择的值是改变的! 所以<select name="inv_payee" id=&qu ...

  5. Html中DIV成为超级链接,解决在360浏览器+IE9显示小手图标的兼容性!

    Html中DIV成为超级链接,解决在360浏览器+IE9显示小手图标的兼容性! <div style="cursor:pointer;" onclick="sele ...

  6. chrome浏览器360浏览器图片无法加载提示等待可用套接字问题

    前端时间遇到chrome,360浏览器无法加载图片问题,提示等待可用的套接字 后来发现原因,原来是使用html5<video>标签时使用了默认的配置,默认情况下<video>标 ...

  7. 如何使用python来模拟鼠标点击(将通过实例自动化模拟在360浏览器中自动搜索"python")

    一.准备工作: 安装pywin32,后面开发需要pywin32的支持,否则无法完成与windows层面相关的操作. pywin32的具体安装及注意事项: 1.整体开发环境: 基于windows7操作系 ...

  8. HTML:meta标签使用总结 [转载] [360浏览器 指定极速模式]

    meta标签作用 META标签是HTML标记HEAD区的一个关键标签,提供文档字符集.使用语言.作者等基本信息,以及对关键词和网页等级的设定等,最大的作用是能够做搜索引擎优化(SEO). PS:便于搜 ...

  9. 360浏览器最小字号12的坑 -彻底搞清rem

    之前做响应式网站,使用rem作为单位.因为浏览器的默认字号是16px,设置html {font-size: 62.5%; /*10 ÷ 16 × 100% = 62.5%*/},刚好1rem =10p ...

随机推荐

  1. hive SQL 静态分区和 动态分区

    Hive 分区介绍: hive中简单介绍分区表(partition table),含动态分区(dynamic partition)与静态分区(static partition) hive中创建分区表没 ...

  2. 使用ansible结合FTP部署zabbix_agent

    想要达到的效果:一条命令,快速对多台主机部署zabbix_agent 实现思路:从源码编译编译出zabbix_agentd,准备好安装脚本,将安装脚本和编译出的agent一起上传到FTP服务器,在an ...

  3. Atitit s2018.5 s5 doc list on com pc.docx  v2

    Atitit s2018.5 s5  doc list on com pc.docx  Acc  112237553.docx Acc Acc  112237553.docx Acc baidu ne ...

  4. fiddler 对https支持

    https://www.cnblogs.com/joshua317/p/8670923.html 测试可行

  5. Python装饰器用法

    在Python中,装饰器一般用来修饰函数,实现公共功能,达到代码复用的目的.在函数定义前加上@xxxx,然后函数就注入了某些行为,很神奇!然而,这只是语法糖而已. 场景 假设,有一些工作函数,用来对数 ...

  6. 用virsh console vhosts 卡住

    [root@666 ok]# virsh list --all Id Name State ---------------------------------------------------- 1 ...

  7. const引用和函数占位参数遇上默认参数以及内联函数

    1.const引用: 但是加上const之后是可以的,const int &a=100;就不会报错了. 2.函数占位参数: 如果给最后的占位参数加上默认值: 3.内联函数 内联只是对编译器发起 ...

  8. zoj 3430 Detect the Virus(AC自己主动机)

    Detect the Virus Time Limit: 2 Seconds      Memory Limit: 65536 KB One day, Nobita found that his co ...

  9. linux系统下键盘按键的重新映射——xmodmap工具和xev工具

    大家会不会有时候,感觉键盘上的某几个键用起来不是很方便,打字打久了很容易手指头疼呢? 例如大家使用vim编辑器时, 经常需要使用到esc键,而该键在左上角,很不方便的.再比如写程序的时候,经常会使用到 ...

  10. open-falcon监控Flume

    1.首先你需要知道flume的http监控端口是否启动 请参考博文 Flume的监控参数 即在 http://localhost:3000/metrics 可以访问到如下内容 2.在open-falc ...