User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 392,009 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,219 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

Selecting all input text fields

Join Date: Jan 2008
Posts: 35
Reputation: mellamokb is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
mellamokb mellamokb is offline Offline
Light Poster

Re: Selecting all input text fields

  #4  
Jan 5th, 2008
Here is full page source that works. I fixed a bug in the javascript I wrote, where I used a single equals where I should have used double equals for comparison:

<html>
    <head>
        <title>Test</title>
        <script type="text/javascript">
        <!--
    
            function setInputTextEnabled(isEnabled)
            {

                inputArray = document.getElementsByTagName("input");
                
                for (var index = 0; index < inputArray.length; index++)
                    if (inputArray[index].type == 'text')
                        inputArray[index].disabled = isEnabled;
                    
            }        
        
        // -->
        </script>
    </head>
    <body>
        <input id="Text1" type="text" value="123" /><br />
        <input id="Text2" type="text" value="123asffdd" /><br />
        <input id="Text3" type="text" value="12353" /><br />
        <input id="Text4" type="text" value="12weaf3" /><br />
        <input id="Text5" type="text" value="12asgd3" /><br />
        <input id="Text6" type="text" value="12asdf3" /><br />
        <input id="Text7" type="text" value="12awef3" /><br />
        <input id="Text8" type="radio" name="r1" value="12awef3" /><br />
        <input id="Text9" type="radio" name="r1" value="12awef3" /><br />
        <input id="Text10" type="checkbox" value="12awef3" /><br /><br />
        
        Change Text Enabled: <input id="Text11" type="checkbox" onclick="setInputTextEnabled(this.checked);" value="12awef3" />
    </body>
</html>

~ mellamokb
Reply With Quote  
All times are GMT -4. The time now is 10:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC