<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<script>
window.onload=function()
{
var txt=document.getElementById("txt");
var btn=document.getElementById("btn");
btn.onclick=function()
     {
var val=txt.value;   //点击按钮之后才会获取文本框中的值
switch(val)
{
case "苹果" :
alert("1元");break;
case "香蕉":
alert("2元");break;
case "梨":
alert("3元");break;
default:
alert("没有这个水果");
}
}
}
</script>
<body>
<input type="text" id="txt"/>
<button id="btn">查询价格</button>
</body>
</html>

  

最新文章

  1. 【PHP夯实基础系列】PHP日期,文件系统等知识点
  2. php自学提升进阶路线
  3. Oracle SQL*plus常用的命令和函数
  4. 让linux中的程序崩溃时生成core文件
  5. DOS通讯录
  6. mysql之创建外键报150错误的处理方法
  7. python装饰器总结
  8. Apache 多站点(虚拟主机)
  9. 实例讲解MSSQL日期相加减比大小函数 转
  10. ajax+XMLHttpRequest里的FormData实现图片异步上传
  11. 调试大叔V1.0.1(2017.09.01)|http/s接口调试、数据分析程序员辅助开发神器
  12. scapyd部署出现的问题的解决方案
  13. Linux学习笔记之Python3的安装以及创建虚拟环境(CentOS)
  14. spring mvc get请求中文乱码问题
  15. 1.创建和销毁对象_EJ
  16. 转:win7下git凭据导致无法clone代码
  17. 数据库编程加入transaction
  18. Java知识回顾 (4)Java包装类
  19. 04 memory structure
  20. spark mysql读写

热门文章

  1. 【Leetcode】整数反转
  2. event.stopPropagation()和event.preventDefault(),return false的区别
  3. Http请求详解(转)----请求+响应各字段详解
  4. NOIP2009靶形数独(暴搜)
  5. 测试常用shell命令
  6. android UI设计及开发
  7. code first System.Data.Entity.Infrastructure.CommitFailedException: An error was reported while committing a database transaction but it could not be determined whether the transaction succeeded
  8. 2、electron进程
  9. ubuntu的无线网无法连上
  10. freemarker程序开发