Help On This Simple Script - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Help On This Simple Script (1019 Views)
| Help On This Simple Script by Setag(op): 6:40pm On Aug 15, 2015 |
Function count() {
var lbl;
document.getElementById('lbl');
for (i=0; i<10; i++) {
lbl.innnerHTML+= i+'<br>';
}
} the tags specifically: <button type='button' onclick='count()'>start counting </button> <div id='lbl'></div> i keep getting this error on IE: unable to get property 'innerHTML' of undefined or null reference. Kinda help fix this and explain.. Cc: dhtml |
| Re: Help On This Simple Script by JackOfAllTrades: 7:16pm On Aug 15, 2015 |
You code will not run because you need to assign the object to the variable do this instead var lbl = document.getElementById('lbl'); |
| Re: Help On This Simple Script by jacob05(m): 7:36pm On Aug 15, 2015 |
you did not assign value to lbl by mistake.. try indenting your codes too, bugs are, sometimes, easily fixed with proper indentation
|
| Re: Help On This Simple Script by Setag(op): 10:18am On Aug 16, 2015 |
jacob05: |
| Re: Help On This Simple Script by Setag(op): 10:21am On Aug 16, 2015 |
jacob05:sorry, the code is properly indented on the editor. My mistake here, but on the real script, I initiated the var and assigned value to it.. I keep getting the same error. I will check it out and get back. |
| Re: Help On This Simple Script by Setag(op): 12:57pm On Aug 16, 2015 |
It worked, saw me mistakes..
Thanks y'all for taking your time.. |
| Re: Help On This Simple Script by Nobody: 1:02pm On Aug 16, 2015 |
Thank God them don kill the bug. |
| Re: Help On This Simple Script by Kensharval(m): 9:01pm On Aug 18, 2015 |
If you wish to have a professional shared
hosting quality in a free hosting package, come
and host with 000webhost.com and
experience the best service you can get
absolutely free.
Founded in December 2006, 000webhost.com
has a trusted free hosting members base of
over 60,000 members and still counting!
Offering professional quality hosting, support,
uptime and reliability, we have a great
community of webmasters, you'd love to be a
part of!
Register now and get it all free:
*** 1500 MB of disk space
*** 100 GB of data transfer
*** PHP and MySQL support with no
restrictions
*** cPanel control panel
*** Website Builder
*** Absolutely no advertising!
Join us now: http://
www.000webhost.com/876430.html |
Allow Me To Ask You This Simple Question About Your Business • Help A Java Newbie With This Simple Java Program • Help On This Simple Script • 2 • 3 • 4
The Latest Social Network In Nigeria • Bosolutions Arena(android Developer) • Learn Web Design In 24 Hours