Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php javascript框不显示-值_Php_Javascript_Html - Fatal编程技术网

Php javascript框不显示-值

Php javascript框不显示-值,php,javascript,html,Php,Javascript,Html,我希望在用户单击-按钮时不显示我的负号。计数应在0结束。 它现在也显示-1、-2、-3个字符。我只想显示0或多个0 <script type="text/javascript" > function plus(){ var addplus = 1; var plus = document.getElementById('qty').v

我希望在用户单击-按钮时不显示我的负号。计数应在0结束。 它现在也显示-1、-2、-3个字符。我只想显示0或多个0

<script type="text/javascript" >                                
            function plus(){
                var addplus = 1;
                var plus = document.getElementById('qty').value;
                addplus = parseInt(addplus) + parseInt(plus); 
                document.getElementById('qty').value = addplus;
            }
            function negtive(){
                var neg;
                var negtive = 1;
                var negtives = document.getElementById('qty').value;
                negtive = parseInt(negtives) - parseInt(negtive);               
                document.getElementById('qty').value = negtive;             
            }
        </script>

函数plus(){
var addplus=1;
var plus=document.getElementById('qty').value;
addplus=parseInt(addplus)+parseInt(plus);
document.getElementById('qty')。value=addplus;
}
函数负(){
var neg;
var负值=1;
var negatives=document.getElementById('qty').value;
negative=parseInt(negatives)-parseInt(negative);
document.getElementById('qty')。值=负数;
}
把这行

if(negtive<0)
    negtive = 0;


document.getElementById('qty').value=((负数)我只希望我的负值现在应该显示在框中,请再次检查..您拼写错误了负数..请在回答中更正..复制并粘贴..负数的拼写是“负数”,而不是“负数”
negtive = parseInt(negtives) - parseInt(negtive); 
document.getElementById('qty').value = ((negtive <0)?0:negtive );