本文介绍了窗口事件在FireFox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个函数来编写和显示在除了FireFox之外的所有浏览器中完美工作的同一页面上的文本。任何想法或帮助材料?
提前致谢!

 函数handleEvent(myEvent){
myEvent = myEvent || window.event;
var FirstTextbox = myEvent.srcElement || myEvent.which;
var SecondTextbox = document.getElementById(companynamefield);
SecondTextbox.value = FirstTextbox.value;
document.getElementById(comapnynameshow)。innerHTML = FirstTextbox.value;



$ b $ div class =h2_lin>解决方案

更改
myEvent.which

myEvent.target



不是哪个被按下,而是 object 被点击了,你正在寻找。



确保您在处理程序中传递事件,如果它是内联的

< ... onkeyup =handleEvent(event) ...




I am using this function to write and display the text on the same page which is working perfectly in all browsers except "FireFox". Any Idea or helping material ? Thanks in advance !

function handleEvent(myEvent) {
     myEvent = myEvent || window.event;
     var FirstTextbox = myEvent.srcElement || myEvent.which;
     var SecondTextbox = document.getElementById("companynamefield");
     SecondTextbox.value = FirstTextbox.value;
     document.getElementById("comapnynameshow").innerHTML =FirstTextbox.value;
   }
解决方案

ChangemyEvent.whichtomyEvent.target

It is not which key was pressed but which object was clicked you are looking for.

Make sure you are passing event in the handler if it is inline

<... onkeyup="handleEvent(event)"...

DEMO

这篇关于窗口事件在FireFox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 22:56