在网页头部定义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. What is a Back Order

    What is a Back Order A back order is a customer order that has not been fulfilled. A back order gene ...

  2. 【转载】SpringCloud-Eurek 心跳阈值说明

    在使用eureka过程中,查看监控界面,出现: EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE ...

  3. Visual Studio 2015 msvsmon.exe crashed when c++ debugging with x64

    Completely uninstalling Astrill fixed the issue but this solution is not what I want. Astrill suppor ...

  4. Mac笔记本中是用Idea开发工具在Java项目中调用python脚本遇到的环境变量问题解决

    问题描述: mac笔记本本身会自带几个python版本,比如python2.7版本,我没有改动mac默认的python版本,只是安装了python3.7版本. 使用Pycharm开发Python项目没 ...

  5. HLS playlist典型示例

    [时间:2018-06] [状态:Open] [关键词:流媒体,HLS,m3u8,playlist,variant, alternate] 0 引言 本文主要是对apple官网上的echnical N ...

  6. linux服务查看

    (1)#service servicename status比如查看防火墙:#service iptables status (2)#chkconfig --list |grep 服务名 比如查看te ...

  7. Redis的KEYS命令引起宕机事件

    摘要: 使用 Redis 的开发者必看,吸取教训啊! 原文:Redis 的 KEYS 命令引起 RDS 数据库雪崩,RDS 发生两次宕机,造成几百万的资金损失 作者:陈浩翔 Fundebug经授权转载 ...

  8. css3图片处理方式 object-fit

    .fill { object-fit: fill; } .contain { object-fit: contain; } .cover { object-fit: cover; } .none { ...

  9. msm audio platform 驱动代码跟踪

    sound/soc/soc-core.c static int __init snd_soc_init(void) { #ifdef CONFIG_DEBUG_FS snd_soc_debugfs_r ...

  10. Ubuntu下安装Kafka Manager

    参考 : kafka管理器kafka-manager部署安装 下载Kafka Manager,并进行打包,由于Kafka manager是由scala写的,所以需要由sbt的支持 git clone ...