在网页头部定义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. maven scope使用和理解

    在Maven的依赖管理中,经常会用到依赖的scope设置.这里整理下各种scope的使用场景和说明,以及在使用中的实践心得. scope的使用场景和说明 1.compile 编译范围,默认scope, ...

  2. python itertools 模块讲解

    1.介绍itertools 是python的迭代器模块,itertools提供的工具相当高效且节省内存. 使用这些工具,你将能够创建自己定制的迭代器用于高效率的循环. - 无限迭代器 itertool ...

  3. C#跑马灯,图片滚动,后台获取图片地址。动态绑定图片,imag显示文字

    下面附下载地址. http://download.csdn.net/download/njxiaogui/10002058 1.跑马灯效果,图片连续循环滚动,图片下面并可附文字描述,图片是从数据库中获 ...

  4. GUI编程及文件对话框的使用

    import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import ...

  5. Resnet BN

    [深度学习]深入理解Batch Normalization批标准化 https://www.zhihu.com/topic/20084849/hot resnet(残差网络)的F(x)究竟长什么样子? ...

  6. nginx:not a directory

    项目需要在nginx中提供一个配置文件返回接口的信息,于是就添加了location来实现,本以为很简单的操作,结果访问配置文件时一直返回404,nginx的error log中输出:not a dir ...

  7. idea当配置eclipse快捷键时,全局替换的快捷键是什么?

    简介   每次为了新版本新建一个分支的时候,都要改每个maven的版本号,好麻烦,有么有?如下图: 当idea配置eclipse快捷键时,默认是没有全局替换快捷键的,需要设置 步骤 首先打开setti ...

  8. 范型方法 & 范型参数 & 范型返回值

    Java范型类 public class FanXingClassTest { public static void main(String args[]){ Test<Integer> ...

  9. Centos&Redhat下bcm43142博通无线网卡linux驱动之二

    上次通过更换内核实现成功编译驱动无线网卡,但是启动到系统原内核下依然没有bcm43142的驱动,遂准备在原内核下编译驱动,记录一下 ps:更推荐这种方法,避免因更换内核出现其他兼容性问题 1.准备驱动 ...

  10. C#高阶与初心:(一)List.Add添加的到底是什么?

    前几日与同事讨论一个相对复杂的场景,需要先将中间过程存储在List中,稍后再用.同时程序类的许多线程共用了一个全局变量. 具体来说就是如下代码 ... _order = order1; _list.A ...