Sagewire Logo

onClick event problem

2 Message(s) by 2 Author(s) originally posted in javascript


From: Magician Date:   Monday, December 25, 2006
Hello.
I am trying to set the onclick event for image s through a function , but the
event is triggered as soon the page loads, then won't work when the image
is clicked. Can anyone suggest what is wrong?
I am using IE6 for testing.

---------------------------------------------------------------------------
window.onload = fnNewWindowLinks;

function fnNewWindowLinks() {
for (var intLinks=0; intLinks<document.links.length; intLinks++) {
if (document.links[intLinks].className == "picture") {
document.links[intLinks].onClick = alert("Clicked");
}
}
}
---------------------------------------------------------------------------
Regards


From: pere.noel Date:   Tuesday, December 26, 2006
wrote in message:

document.links[intLinks].onClick = alert("Clicked");



i think it is because you define the function that way, instead of this
one :

...onclick=THE_function_U_want_2_activate;

notice no "()" ...

better than speaking here i have build a small example here :

<www.yvon-thoraval.com/JS/events/onclick.html>

see source code ))

--
Père Noël



Next Message: Uncaught Exception... I've no clue about.


Blogs related to onClick event problem

Java script function Java script function Java script function ...
Free java game download; Free online java game Java game play Free nokia java game Java game downloads Java casino ... Free java program script Calendar event free java script Error fix free java script Free java menu navigator script ...

Run client javascript after servercode is executed right ?
I have a problem, i have a event in asp.net codebehind file that ... Which means that you should remove the "onclick" attribute from your button. ... Note also that JavaScript uses the Java naming and coding conventions, ...

Ajax rsource
ThinkCAP's innovative 3-tier event model allows developers to us the power of the server to ... Net, although Taconite does have its roots in Java EE. ... an exported method with a document-defined event (such as onClick, onKeyUp, etc). ...

Java Interview Questions - Java Server Faces(JS...
h:commandLink assign the onclick attribute for internal use. So, you cannot use it to write your own code. This problem will fixed in the JSF 1.2. For the current JSF version you can use onmousedown event that occurs before onclick. ...

Ajax and Velocity using Springmodules
I followed tutorial (chapter 17) on https://springmodules.dev.java.net/, they work with jsp and ... public AjaxResponse loadOffices(AjaxActionEvent event){ ... I am using java 1.5, spring 1.2.8, apache tomcat 5.5.17, springmodules 0.7 ...

Blogger's Block #3: Dreaming in Browser Swamp
One big problem is that it's JavaScript. Nobody wants to use JavaScript. ... That's what most non-web programmers think, whether they use Java or C++ or C# ... weaned from text to HTML to onclick="foo.hide()" and onwards to CSS and DOM ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional