开发者

JavaScript - How to Insert Number to InputBox by using Button

开发者 https://www.devze.com 2023-03-06 13:16 出处:网络
Please help, How to insert number into inputbox by Id. <input name="table1" type="text" size="1" id="musicstock1"/>

Please help, How to insert number into inputbox by Id.

<input name="table1" type="text" size="1" id="musicstock1"/>

Would like to insert for example number (5) into this particular input box when button clicked.

So push the "Insert" button number 5 show on inputbox

is this correct?

function insert () {
    document.getElementById('musicstock1').innerHTML = "5";
}

Thank you in adva开发者_如何学JAVAnce

Appericiate for Replys... Please Check @

http://jsfiddle.net/JxfcH/#

Not Worked..


you must assign value to the "value" attribute of the input box.

document.getElementById("musicstock1").value = "5";


You want:

function insert () {
    document.getElementById('musicstock1').value = "5";
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号