...

View Full Version : help with javascript-arrows for increase/decrease



katti
07-23-2011, 02:26 PM
Hi I'm completely stuck, I am looking for placing small
up and down arrows next to my textbox. They would work with by increasing/decreasing number of products. The text box would be active so a client could put the number of a product himself/herself or simply by clicking the up/down arrows next to the text box.

I am not sure how to look for it, I mean I thought something like that should exist by default, I search w3c and I can find only combo box etc.
Could someone put me on the right track please?..

vwphillips
07-23-2011, 03:36 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/

function Add(id,ud){
var obj=document.getElementById(id);
obj.value=obj.value.replace(/\D/g,'');
obj.value=Math.max((obj.value=obj.value||'0')*1+ud,0);;
}
/*]]>*/
</script></head>

<body>
<form >
<input name="number" id="number" />
<img alt="Up" class="butV" id="up" src="http://www.vicsjavascripts.org.uk/StdImages/Up1.gif" onmouseup="Add('number',1);" />
<img alt="Down" class="butV" id="down" src="http://www.vicsjavascripts.org.uk/StdImages/Down1.gif" onmouseup="Add('number',-1);" />

</form>
</body>

</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum