首先需要div布局,先需要将整体的框架布局起来:
HTML效果的截图如下:
这个效果最重要的代码如下:
var txt = document.getElementById('txt');
txt.onblur = function(){
if (txt.value == '') {
txt.value = '0';
}
}
4.在浏览器里面浏览的如下:
首先:$(this).val()你确定是得到input中的内容?
其次:赋值是这样$(this).val(0);
//用这个
if(!$(this.val())){
$(this).val(0);
}
$(this).val(‘你的值’)这样写 才正确
不用jquery呗:
1、给input定义id 比如:id="myinput"
2、js里获取并判断设置
body>