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
    Regular Coder
    Join Date
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts

    How to clear the border color (preserving the existing one) ??

    Hello Forums !!
    I had following script for marking the fields with certain color border and clearing that color border , preserving the fields original border color.
    Code:
    <!-- Javascript -->
    <script language="javascript">
    function FMark(){
    	document.forms['frm_mark'].test_field.style.border = "1px solid #ff0000";  
    }
    
    function FClear(){
    	document.forms['frm_mark'].test_field.style.border = "none"; 
    }
    </script>
    <!-- HTML -->
    <form name="frm_mark" action="#" method="get">
    <input type="text" name="test_field" style="border: 1px solid #0066FF" />
    <input type="button" value="Mark" onclick="FMark();"/>
    <input type="button" value="Clear" onclick="FClear();"/>
    </form>
    Whats my problem ?
    - I am able to mark the field but also able to clear that marked one but couldnt preserve the existing border color

    What I want ?
    - I want to clear the marked border color preserving the existing border color ie #0066FF
    Any Suggestion and Help are warmly welcome
    Thanks in advance to all of you
    Last edited by PHPycho; 07-15-2007 at 10:52 AM.

  • #2
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Make a global var of your current color and everytime you switch the color - change the current color var.


  •  

    Posting Permissions

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