[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

JavaScript disabled property problem with FireFox

Posted on 2008-11-13
1
Medium Priority
?
4,256 Views
Last Modified: 2012-05-05
I am writing a simple javascript code that expriments how to enable, disable html elements using JavaScript code.
I am getting the code to work on IE but FireFox seems to ignore the code without error.
In FireFox I am getting the 'called' message box but the button is not being enabled/disabled as IE does when the second button is clicked.
See attached code.

Thanns
<head runat="server">
    <title></title>
    
    <script type ="text/javascript">
      function EnableButton(id) {
 
        alert('called');
        var obutton = document.getElementById(id);
        if (obutton.isDisabled == true) obutton.disabled = false;
        else obutton.disabled = true;
          
 
        return false;
      }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:Button ID="Button1" runat="server" Text="Button"   Enabled ="false" />
        
        <asp:Button ID="Button2" runat="server"
          Text="Button" OnClientClick ="return EnableButton('Button1');"/>
    </div>
    </form>
</body>

Open in new window

0
Comment
Question by:Kan64
1 Comment
 
LVL 82

Accepted Solution

by:
hielo earned 200 total points
ID: 22956165
try:
<script type ="text/javascript">
      function EnableButton(id) {
 
        alert('called');
        var obutton = document.getElementById(id);
        obutton.disabled = ( obutton.disabled ? false: true);
        return false;
      }
    </script>

Open in new window

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question