[英]Is it possible to call two javascript functions on one html event?
I'm trying something like this: 我正在尝试这样的事情:
<textarea onFocus = "myFunction(1)" onBlur = "myFunction(0); return submitform();">
Is this possible? 这可能吗?
Yes but the syntax is wrong, see this edited textarea: 是的,但语法错误,请参阅此编辑的textarea:
<textarea onfocus="myFunction(1);" onblur="myFunction(0); return submitform();">
^------ ^-------- small letter is important
A yet better way would be to attach jQuery event handlers, or similiar with a different preferred framework. 更好的方法是附加jQuery事件处理程序,或者类似于不同的首选框架。
Yes you can. 是的你可以。 The text between the two "" is actually considered as a function.
两个“”之间的文本实际上被视为一个函数。 So it is a unnamed function calls your other functions.
所以它是一个未命名的函数调用你的其他函数。
Answer given by @DanFromGermny is right, @DanFromGermny给出的答案是对的,
you can try this also 你也可以尝试一下
<textarea onfocus="myFunction(1);" onblur="(function(){myFunction(0); return submitform();})(event)">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.