使文本框确定javascript变量

时间:2015-02-21 19:46:50

标签: javascript variables button textbox

我需要一个javascript变量,以便在按下按钮时输入到文本框中。

基本上,如果有人进入"气泡"进入文本框,然后单击“提交”按钮,我需要" var Item"成为泡沫。我该如何制作这个功能?

如果可能,我想要if语句,所以像

    var Item = getElementById(whatever the id of the textbox content it)
    function Thing() {
    if {
    getElementById(whatever the id of the textbox content it) = bubbles;
    document.open(P2.html);
    }

1 个答案:

答案 0 :(得分:0)

你可以得到这样的价值:

<script>
    function getValue(){
        var value = document.getElementBydId("textbox").value;
    }
</script>
<textarea id="texbox"></textarea>
<button onclick="getValue()">