www.webdeveloper.com
Results 1 to 6 of 6

Thread: Script not working in IE9

  1. #1
    Join Date
    Nov 2013
    Posts
    8

    Script not working in IE9

    This works perfectly in Chrome but not in IE9. Do not understand why.

    Code:
    <script>
    
    var result = 0;
    
    		function add(button, knappen)
    		{
    				if (button=="Knapp1") {
    					document.getElementById(button).innerText = ++result;
    					document.getElementById(knappen).disabled = true;
    					document.getElementById(button).innerHTML = result;			
    				}
             
    				if (button=="Knapp2") {
    					document.getElementById(button).innerText = ++result;
    					document.getElementById(knappen).disabled = true;
    					document.getElementById(button).innerHTML = result;				
    				}
    				
    				if (button=="Knapp3") {
    					document.getElementById(button).innerText = ++result;
    					document.getElementById(knappen).disabled = true;
    					document.getElementById(button).innerHTML = result;
    				}				
    			
    		}
    	
    </script>
    
    <table>
    <tr>
        <td><b>Destination:</b></td>
        <td><b><?php echo $row['destination1']; ?> </b></td>
        <td width="120"><button onclick="add('Knapp1','Knappen1');" id="Knappen1">Knapp 1</button><td>
    	<td><div id="Knapp1"></div></td>
      </tr>
      <tr>
        <td><b>Destination:</b></td>
        <td><b><?php echo $row['destination2']; ?></b></td>
        <td width="120"><button onclick="add('Knapp2','Knappen2');" id="Knappen2">Knapp 2</button></td>
    	<td><div id="Knapp2"></div></td>
      </tr>
      <tr>
        <td><b>Destination:</b></td>
        <td><b><?php echo $row['destination3']; ?></b></td>
        <td><button onclick="add('Knapp3','Knappen3');" id="Knappen3">Knapp 3</button></td>
    	<td><div id="Knapp3"></div></td>
      </tr>
    </table>

  2. #2
    Join Date
    Oct 2013
    Location
    Kalyan , Mumbai , India
    Posts
    4
    its working fine on ie9 on my system
    check this fiddle

  3. #3
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Are you sure you have IE configured to run scripts?
    Does a simple alert work?

  4. #4
    Join Date
    Nov 2013
    Posts
    8
    Works in Chrome but in IE9 I get: Unable to set value of the property 'value': object is null or undefined
    Code:0
    Line 40 Char 2

    Not sure if the Line of the problem is correct, can I trust it? If so here is the Line 39 + 40:

    if (button=="Knapp1") {
    document.getElementById(button).innerText = ++result;

  5. #5
    Join Date
    Nov 2013
    Posts
    8
    Just a question: How do I edit a post here at webdeveloper.com?

    Just ignore my previous post. The script can show alert messages but will not disable the button, only in IE. No error in the script according to IE.

  6. #6
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Quote Originally Posted by md7dani View Post
    Just a question: How do I edit a post here at webdeveloper.com?
    On this site the Edit button times-out after a moronically short time.

    Quote Originally Posted by md7dani View Post
    Just ignore my previous post. The script can show alert messages but will not disable the button, only in IE. No error in the script according to IE.
    For disabled attribute support in IE9 you may need to use <!doctype html>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles