Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    help with javascript-arrows for increase/decrease

    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?..

  2. #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,583
    Thanks
    3
    Thanked 516 Times in 503 Posts
    Code:
    <!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>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. Users who have thanked vwphillips for this post:

    katti (07-23-2011)


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •