我一直在使用以下内容:
<form onsubmit="javascript: alert('sending...'); return false;">
<input type="text" id="screen" />
<div id="keypad">
<button>7</button>
<button>8</button>
<button>9</button>
<br />
<button>4</button>
<button>5</button>
<button>6</button>
<br />
<button>1</button>
<button>2</button>
<button>3</button>
<br />
<button>0</button>
</div>
</form>
window.onload = function () {
var screen = document.getElementById('screen'),
keypad = document.getElementById('keypad'),
buttons = keypad.getElementsByTagName('button');
for (var i = 0; i < buttons.length; i++) {
buttons[i].onclick = function () {
screen.value = screen.value + this.innerHTML;
return false;
};
}
};
(http://jsfiddle.net/nTzY4/3/)
我想让文本框变得更大,我该怎么做?想要高度和长度更大。
答案 0 :(得分:0)
添加类似的类并使css更改元素
.bigger
{
width: 100px;
height: 30px;
}
<input class="bigger" type="text" id="screen" />
答案 1 :(得分:0)
CSS是解决方案:
#screen
{
width: 500px;
height: 50px;
font-size: 40px;
}
#keypad button
{
width: 165px;
height: 50px;
}
在JsFiddle中,你把它放在CSS部分,在你把它放在.css文件中的真实网站中:http://www.w3schools.com/css/css_howto.asp