<!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. Spring Boot的SpringApplication类详解

    相信使用过Spring Boot的开发人员,都对Spring Boot的核心模块中提供的SpringApplication类不陌生.SpringApplication类的run()方法往往在Sprin ...

  2. Chrome nacl开启

    Chrome nacl开启

  3. sql存储过程中,如何根据指定日期、月数、天数推算预产日期

    我这边有一个业务,根据某个指定日期,推算某个患者的预产日期 原理:比如孕产的预产日期的算法(预产日期 = 末次月经日期+ 10月+8天) 那么我们怎么通过存储过程来实现呢? 首先分析条件 需要一个指定 ...

  4. linux abstract model of virtual memory

  5. 快速切题 sgu117. Counting 分解质因数

    117. Counting time limit per test: 0.25 sec. memory limit per test: 4096 KB Find amount of numbers f ...

  6. HSSFWorkBooK用法 —Excel表的导出和设置

    HSSFWorkBooK用法 —Excel表的导出和设置 2013年02月21日 ⁄ 综合 ⁄ 共 9248字 ⁄ 字号 小 中 大 ⁄ 评论关闭 public ActionResult excelP ...

  7. 2018-北航-面向对象第三次OO作业分析与小结

    1. 规格设计的发展历史 规格设计用于对程序设提供分解,抽象等的手段.在撰写代码规格的时候,需要对组成部件进行抽象. 在1960s,软件设计出现危机,例如Dijkstra提出了goto语句的种种危害, ...

  8. 移动前端开发之viewport的深入理解 --- 待续

    在移动设备上进行网页的重构或开发, 只有明白了viewport的概念 才能 响应 各种  不同分辨率 的移动设备 一.viewport的概念 通俗的讲,移动设备上的viewport就是设备的屏幕上能用 ...

  9. 【转】DelphiXE10.2.3——跨平台生成验证码图片

    原文地址 Java.PHP.C#等很容易在网上找到生成验证码图片的代码,Delphi却寥寥无几,昨天花了一整天时间,做了个跨平台的验证码,可以用在C/S和B/S端,支持Windows.Linux.An ...

  10. Tensorflow中的滑动平均模型

    原文链接 在Tensorflow的教程里面,使用梯度下降算法训练神经网络时,都会提到一个使模型更加健壮的策略,即滑动平均模型. 基本思想 在使用梯度下降算法训练模型时,每次更新权重时,为每个权重维护一 ...