开发者

Upper/Downy controls for HTML

开发者 https://www.devze.com 2023-01-26 22:01 出处:网络
In开发者_如何学C Windows Forms apps, you can add an upper downy control to the form. It just has a textbox with two buttons next to it, that let youincrement or decrement the value in the textbox on t

In开发者_如何学C Windows Forms apps, you can add an upper downy control to the form. It just has a textbox with two buttons next to it, that let you increment or decrement the value in the textbox on the left. Is there a control like that for HTML? I haven't been able to find one.


You can style it how you like, but you can implement it as follows...

<p><input type="text" name="uppydowner" id="uppydowner" value="1" size="2"> 
    <span id="uppy"></span> <span id="downy"></span></p>

<script type="text/javascript">
    var upButton = document.getElementById("uppy");
    var downButton = document.getElementById("downy");
    var resultBox = document.getElementById("uppydowner");

    upButton.innerHTML = "+";
    downButton.innerHTML = "-";

    upButton.onclick = function () {
        var current = parseInt(resultBox.value);
        current++;
        resultBox.value = current;
    };

    downButton.onclick = function () {
        var current = parseInt(resultBox.value);
        current--;
        resultBox.value = current;
    };
</script>


It does not exist, you must build this behaviour with JavaScript.

You place a textarea or a div and use JavaScript to scroll the content up or down.

I've read about it somewhere in the past, but I can't recall where, sorry... :\


You can use this control : http://www.onlinetools.org/tests/countertest.html . It is a simple javascript modification of the input control.

0

精彩评论

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