www.webdeveloper.com
Results 1 to 3 of 3

Thread: cannot get property 'value' of null

  1. #1
    Join Date
    Feb 2013
    Posts
    2

    Question cannot get property 'value' of null

    hello i got some code which used to work in my previous javascripts and now it's giving me this damn error again i don't see what i am doing wrong could someone tell me please.
    Code:
    <html>
    <head>
    <script>
    function fill() {
    	document.getElementById("content").innerHTML="";
    	var rij=parseFloat(document.getElementById("aap").value);
    	var kolom=parseFloat(document.getElementById("kolom").value);
    	for (i=0;i<kolom;i++) {
    		for (j=0;j<rij;j++) {
    			document.getElementById("content").innerHTML+="<input type='number' value='0' id='m"+i+j+"'>";
    		}
    		document.getElementById("content").innerHTML+="<br>";
    	}
    }
    </script>
    </head>
    <body id="content">
    <input type="number" id="aap" value="2" /> x <input type="number" id="kolom" value='3'/><br>
    <input type="button" onclick="fill()" value="matrix">
    </body>
    </html>

  2. #2
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Quote Originally Posted by gelatine1 View Post

    document.getElementById("content").innerHTML="";
    The first thing you're doing is wiping-out the entire content of <body>, so how can you expect to refer to what no longer exists?

  3. #3
    Join Date
    Feb 2013
    Posts
    2

    Thumbs up thank you

    Ohhh stupid from me i didn't see that. thanks for your help.

Thread Information

Users Browsing this Thread

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

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
  •  
HTML5 Development Center



Recent Articles