<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
<script type="text/javascript">
function showMessage()
{
if(document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].value==1)
{
alert("你好,你选择了第 1 个");
document.getElementById("divMessage").innerText=document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].value;
}
else if(document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].value==2)
{
alert("你好,你选择了第 2 个");
document.getElementById("divMessage").innerText=document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].value;
}
else if(document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].value==3)
{
alert("你好,你选择了第 3 个");
document.getElementById("divMessage").innerText=document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].value;
}
else if(document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].value==4)
{
alert("你好,你选择了第 4 个");
document.getElementById("divMessage").innerText=document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].value;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<body>
<select id="selectID" onchange="return showMessage()">
<option value="0">-----请选择----</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<div id="divMessage"></div>
</body>
</html>

无标题页

-----请选择----
1
2
3
4

 

select选中事件的更多相关文章

  1. jquery事件之select选中事件

    根据select下拉列表选中的不同选项执行不同的方法,工作中经常会用到,这里就要用到Jquery的select选中事件 这里给select加一个叫label_id的id,然后通过id选择器找到这个节点 ...

  2. 使用layui的form.on绑定select选中事件, form.on()不执行的原因分析

    使用layui的form.on绑定select选中事件中, form.on()不执行, 主要原因有 1, select标签中没有写lay_filter属性,用来监听 <select id=&qu ...

  3. 用jquery给select加选中事件

    select在前端开发过程中很常用,现在我们要实现一个效果,那就是选中select中的某一项,执行事件,本来自己没怎么接触过这些,最后网上找了一些资料,自己研究了一下,把方法分享给大家,大家如果有需要 ...

  4. jQuery获取Select选中的Text和Value

    获取Select选中的Text和Value语法解释:$("#select_id").change(function(){//code...});   // 为Select添加事件, ...

  5. Jquery常用radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关设置

    获取一组radio被选中项的值:var item = $('input[name=items][checked]').val(); 获取select被选中项的文本:var item = $(" ...

  6. js获取select改变事件

    js获取select改变事件onchage前的值 和 onclick事件 <select id="wupin_id" name="wupin_id" on ...

  7. jQuery获取Select选中的Text和Value,根据Value值动态添加属性

    语法解释:1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发2. var chec ...

  8. jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中

    jQuery获取Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code...}); //为Se ...

  9. jQuery获取Select选中的Text和Value,根据Value值动态添加属性等

    语法解释:1. $("#select_id").change(function(){//code...});   //为Select添加事件,当选择其中一项时触发2. var ch ...

随机推荐

  1. Access-Control-Allow-Origin实现跨域访问 跨域

    总结:跨域的get,post请求 后台可以设置 Access-Control-*相关的参数,让浏览器支持. // 指定允许其他域名访问 header('Access-Control-Allow-Ori ...

  2. 如何获取显示器的EDID信息

    Q1: 为什么要写这篇文章? A1:在最近的工作中遇到了不少问题,其中很多都是和EDID相关的.可以说,作为一家以“显示”为生的企业,我们时时刻刻在与EDID打交道.EDID这东西很简单,但是如果不了 ...

  3. Get gcc built-in macros using command gcc -dM -E - < /dev/null

    root@vmuser-virtual-machine:/home/vmuser# gcc -dM -E - < /dev/null #define __SSP_STRONG__ 3#defin ...

  4. 模拟QQ分组

    package com.lixu.fenzu; import java.util.ArrayList; import java.util.HashMap; import android.app.Lis ...

  5. 扫描系统句柄表(WIN7 x86)(附录源码)

    PspCidTable存放着系统中所有的进程和线程对象,其索引也就是进程ID(PID)或线程ID(TID).先通过它来看看windbg里的HANDLE_TABLE结构: 可以看到地址 0x83f41b ...

  6. DevExpress v17.2新版亮点——Data Access

    用户界面套包DevExpress v17.2日前终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了Data Access v17.2 的新功能,快来下载试用新版本! 新的API可在 ...

  7. SOD范例

    SOD申请台站波形数据范例: <?xml version="1.0"?> <sod> <eventArm> <fdsnEvent> ...

  8. Jmeter实现MySQL的增删改查操作

    环境: JDBC驱动:mysql-connector-java-5.1.7-bin Jmeter:Jmeter3.0 1.导入JDBC驱动:测试计划-->浏览-->选择mysql-conn ...

  9. tomcat部署和启动2

    catalina run 启动服务器后,按下CTRL+C,停止服务器,选择"y",退回到正常命令行. catalina stop

  10. 网页瀑布流布局插件Masonry

    CSS3有实现类似瀑布流布局的属性column,但是遗憾的是这种布局是纵向布局而不支持横向布局.所以比较合适用于文字多列布局. 调用JQuery WaterFall布局插件:http://masonr ...