开发者

chrome and javascript: onclick issues

开发者 https://www.devze.com 2023-01-13 17:59 出处:网络
i am on a pc using javascript and chrome. the issu开发者_开发技巧e is the following <a href=\"#\" onClick=\"classClick(event,1)\"This is not working in chrome, but is working perfeclty in FF. I tri

i am on a pc using javascript and chrome. the issu开发者_开发技巧e is the following

<a href="#" onClick="classClick(event,1)"

This is not working in chrome, but is working perfeclty in FF. I tried "onChange" as was recommended by some results on a search, but still no luck. Any hints?


What exactly isn't working and what are you trying to do?

I just tested this on chrome and it worked

<a href="#" onClick="alert('flag')">Flag Link</a>


thank you for answering the question, i did not pose it in the way i intended. this is for legacy if anyone stumbles upon this question.

this code works for translating an event in FF,IE, and Chrome on PC. i will edit later for Mac compatibility if need be for safari.

<span onclick="multiBrowserEventHandling(event)">Trigger</span>
<script>
function multiBrowserEventHandling(e){
     if(e.srcElement==undefined){
          e=e.originalTarget.innerHTML;
     }else{
          e=e.srcElement.innerHTML;
     }
}
</script>


It may because the translate function name is a reserved word to google chrome extensions.

For instance the function name 'translate()' cannot be used in chrome unless refering to the real translate.google.com service.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号