Scenarios where event handler is not called

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

Scenarios where event handler is not called

Post by LiveFree »

Hello All,

Im looking for any reasons why this will not fire:

Code: Select all

....... html stuff....
<script type='text/javascript'>
     function checkuser() {
         alert("This is a test");
         var user = document.getElementById("user").value;
    }
</script>
........ more HTML .......
<input type='button' value='click me' name='hahaha' onclick='checkuser()' />
Of course my code has more detail than that, but the event handler is not firing and the alert() is not executing as well.



before anyone asks- I do have JavaScript enabled
:lol:
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

do you have a javascript debugger?
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

Post by LiveFree »

No,

Is there a relation between the location of the function def and the spelling of the event handler?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: Scenarios where event handler is not called

Post by s.dot »

LiveFree wrote:Hello All,

Im looking for any reasons why this will not fire:
Erm.. it works for me... I copied and pasted your code into notepad, save as HTML file, ran it and it worked perfectly. It's likely your other html that is causing it to not fire.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

LiveFree wrote:No,

Is there a relation between the location of the function def and the spelling of the event handler?
No, provided that the entire page has loaded. Spelling... yes. OnClick, onclick, and onClick will work.. but onlckick won't. :P
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply