• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

strange javascript problem

DJFuji

Diamond Member
ClickButton1 doesn't fire the click event. ClickButton2 fires. As you can tell, the only difference is the bloody alert() method. Can't figure out what the hell the problem is here.

This event is being called by this ASP.NET code: this.txtStudentID.Attributes.Add("onkeydown", "clickButton('OrgsIndividualDDL1:btnSubmit')");

Any ideas?
 
Maybe you didn't even call the function? 😛 This might sound stupid but I have encountered a few of these gotchas before 😱
 
In my code, ClickButton 1 and 2 are the same function. When i uncomment the alert() command, it fires and everything works. Then I go into the .js file, comment out the alert() method, and refresh the page. Nothign happens. I can repeat this process endlessly and get the same results. Very frustratng.
 
Seems like you might be binding to the wrong event before you detect the enter key. By firing an alert first, you sometimes will force certain keyboard events to fire because the focus goes to the alert window. What is the event you are using to call the function?

NM, hooked on phonics, etc.

Try a different keystroke event. Try keypress. If I'm remembering correctly, keydown doesn't always work with the enter key for some reason.

Edit: I've got it backwards. Check this article out:

http://msdn.microsoft.com/library/defau...dowsformscontrolclasskeypresstopic.asp

And more importantly this one for a possible solution

http://msdn.microsoft.com/library/defau...ndowsformscontrolclasskeydowntopic.asp
 
whoa....it doesnt work at all in FF. Even when i have IE and FF open to the same page, IE works but FF doesn't. Nothing in JS console. Weird...
 
Back
Top