<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(function(){
$('#btn').click(function(){
var iPrice=parseFloat($('#price').val())||0;
if(iPrice>3000)
iPrice=3000;
$('p').html(iPrice);
});
})
</script>
</head><body>
<input type="text" name="price" id="price" />
<input type="button" id="btn" value="计算" /><p>
<!-- 显示区域 -->
</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(function(){
$('#btn').click(function(){
var iPrice=parseFloat($('#price').val())||0;
if(iPrice>3000)
iPrice=3000;
$('p').html(iPrice);
});
})
</script>
</head><body>
<input type="text" name="price" id="price" />
<input type="button" id="btn" value="计算" /><p>
<!-- 显示区域 -->
</p>
</body>
</html>
解决方案 »
- 请问在本地环境下主页面能否得到iframe里面b页面的input值吗?
- 求一简单JS弹出层
- Ext采用viewport布局,怎么设置树的超链接?
- 呃 求助,烂IE (wordpress, ff/chrome都没报错) 也请大家帮忙测试下ie下有问题没
- 十万火急 在线等待! 网也被<script></script>和<iframe></ifame>挂木马!!!
- ☆★☆★☆★☆★Javascript读取特定标签的值的方式[解决给分,在线等]☆★☆★☆★☆★☆★☆★
- 关于innerhtml的语法检查问题
- javascript object 对像的使用问题
- 热点话题关于JS DOC
- replace中的正则表达式如何写?
- 请教JS参数传递。
- javascript 获取输入框内的值,生成前一天后一天的功能
从来没这么用过,涨姿势