Home > Backend Development > PHP Tutorial > php js 文本框 值增减有关问题

php js 文本框 值增减有关问题

WBOY
Release: 2016-06-13 10:28:19
Original
818 people have browsed it

php js 文本框 值增减问题
想做那种 就是中间一个文本框 输入数量 同时左边是减号 点击下 数量自减 右边是加号 点一下自加
我在网上找了很多代码 都可以用 但是我放进我自己的代码里面都失效 这是为什么?

我的页面上是循环显示产品 每个产品里面可以选择数量 其实就是最基本的购物功能,然后数量左右两边有按钮可以直接自增自减。代码插进去什么反应都没有。。

现在的代码如下:

JScript code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><script language="javascript" type="text/javascript">var flag1=0; var flag2=0; function NumberInc() { if(flag1==1 && flag2==1) {alert("Error!");} else { if(flag1==1) { document.all.textbox_qty.value++; setTimeout("NumberInc()",100); } if(flag2==1) { document.all.textbox_qty.value--; setTimeout("NumberInc()",100); } } } function md(obj) { if(obj.id=="Button1") flag1=1; if(obj.id=="Button2") flag2=1; NumberInc(); } function mo(obj) { if(obj.id=="Button1") flag1=0; if(obj.id=="Button2") flag2=0; } </script>
Copy after login

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->while($get_details=mysql_fetch_array($result))            {                             //....                echo "
Copy after login
"; echo "
"; echo "
"; echo "
"; echo "\$"; echo "$prices[0]"; echo "."; echo "$prices[1]"; echo "
"; echo "
php js 文本框 值增减有关问题
"; echo "
"; echo "
"; echo "
$dish_name
"; echo "
Description: $dish_descr
"; echo "
  Qty:"; echo ""; echo ""; echo ""; echo ""; echo "
"; echo "
"; echo "
"; echo ""; echo "
"; }

------解决方案--------------------
因为Min和库函数重复了,改名
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template