Javascript code works on IE but fails on Chrome

R.Rubio

This code works fine on IE, but fails on Chrome.

Theory: When you click on the input, the input marks with an X or when you hit again the X is deleted (just like a checkbox) , when any of these conditions are met, the script should send the forms Y ( if X is checked) or N (if X is empty ).

HTML

Note: The values are generated dynamically using the data from a external database).

<input type="text" READONLY id="65535" class="chk" iffalse="N" iftrue="Y" value=""
    onclick="fchkboxclick();" />

JavaScript

function fchkboxclick() {
    object = window.event.srcElement;
    if (object.id == '65535') {
        if (object.value == 'X') {
            activevalue = object.getAttribute("iffalse");
            objet.value = '';
        } else {
            activevalue = object.getAttribute("iftrue");
            object.value = 'X';
        }
    } else {
        if (object.value == 'X') {
            sendevent(object.id, 'check', object.getAttribute("iffalse"));
        } else {
            sendevent(object.id, 'check', object.getAttribute("iftrue"));
        }
    }
}

When I run this on any version of IE, the forms (sendevent function) receive the value from the attribute (Y or N) but in Chrome I just receive X.

Any help would be appreciated. Thanks.

Jaromanda X

if you use an onclick event in an element, far easier to do this

<input onclick="dosomething(this);" />

Then your code can do

function dosomething(element) {
    // element is the element that was clicked
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Javascript code works on IE but fails on Chrome

From Dev

My javaScript code is causing IE to time out but works on Chrome and Firefox

From Dev

JQuery Code works in chrome and IE but it not works in firefox

From Dev

JQuery Code works in chrome and IE but it not works in firefox

From Dev

javascript mailto works in chrome but not IE

From Dev

Simple menu works in chrome, fails in IE

From Java

Code not running in IE 11, works fine in Chrome

From Dev

javascript works in Chrome does not work in IE

From Dev

Jquery Javascript only works on chrome and firefox, but not on IE

From Dev

JavaScript not working in IE and Firefox, works fine in Chrome

From Dev

JavaScript login button works in IE but not in Chrome or Firefox

From Dev

CSS white-space nowrap IE fails but works Firefox/Chrome

From Dev

CSS white-space nowrap IE fails but works Firefox/Chrome

From Dev

Java Applet with form based authentication works on IE fails on Chrome

From Dev

Javascript regex works on online validator but fails in code

From Dev

Anybody knows what is the replacement for this code in IE?..It works in firefox,chrome.( = () => )

From Dev

jQuery code working in Firefox but fails in Chrome and IE8

From Dev

HTML form with javascript gets "NaN" in IE but works in Chrome

From Dev

Javascript does not execute on Chrome but works fine on FF and IE

From Dev

Javascript works in JS Fiddle but doesn't work in Chrome/IE

From Dev

Passing a c# Textbox as a javascript parameter in IE (Chrome works)

From Dev

JavaScript submit does not work in Chrome/Safari, but works fine in Firefox/IE

From Dev

Javascript Countdown shows NaN in IE and Firefox, works in Chrome

From Dev

HTML form with javascript gets "NaN" in IE but works in Chrome

From Dev

This Javascript doesn't work in IE but works in Chrome, Firefox and Opera

From Dev

Javascript works in JS Fiddle but doesn't work in Chrome/IE

From Dev

jQuery/Javascript function works in Chrome but not IE11

From Dev

JavaScript submit does not work in Chrome/Safari, but works fine in Firefox/IE

From Dev

Google+ sign-in works always in Chrome, but fails after time in IE and FF

Related Related

  1. 1

    Javascript code works on IE but fails on Chrome

  2. 2

    My javaScript code is causing IE to time out but works on Chrome and Firefox

  3. 3

    JQuery Code works in chrome and IE but it not works in firefox

  4. 4

    JQuery Code works in chrome and IE but it not works in firefox

  5. 5

    javascript mailto works in chrome but not IE

  6. 6

    Simple menu works in chrome, fails in IE

  7. 7

    Code not running in IE 11, works fine in Chrome

  8. 8

    javascript works in Chrome does not work in IE

  9. 9

    Jquery Javascript only works on chrome and firefox, but not on IE

  10. 10

    JavaScript not working in IE and Firefox, works fine in Chrome

  11. 11

    JavaScript login button works in IE but not in Chrome or Firefox

  12. 12

    CSS white-space nowrap IE fails but works Firefox/Chrome

  13. 13

    CSS white-space nowrap IE fails but works Firefox/Chrome

  14. 14

    Java Applet with form based authentication works on IE fails on Chrome

  15. 15

    Javascript regex works on online validator but fails in code

  16. 16

    Anybody knows what is the replacement for this code in IE?..It works in firefox,chrome.( = () => )

  17. 17

    jQuery code working in Firefox but fails in Chrome and IE8

  18. 18

    HTML form with javascript gets "NaN" in IE but works in Chrome

  19. 19

    Javascript does not execute on Chrome but works fine on FF and IE

  20. 20

    Javascript works in JS Fiddle but doesn't work in Chrome/IE

  21. 21

    Passing a c# Textbox as a javascript parameter in IE (Chrome works)

  22. 22

    JavaScript submit does not work in Chrome/Safari, but works fine in Firefox/IE

  23. 23

    Javascript Countdown shows NaN in IE and Firefox, works in Chrome

  24. 24

    HTML form with javascript gets "NaN" in IE but works in Chrome

  25. 25

    This Javascript doesn't work in IE but works in Chrome, Firefox and Opera

  26. 26

    Javascript works in JS Fiddle but doesn't work in Chrome/IE

  27. 27

    jQuery/Javascript function works in Chrome but not IE11

  28. 28

    JavaScript submit does not work in Chrome/Safari, but works fine in Firefox/IE

  29. 29

    Google+ sign-in works always in Chrome, but fails after time in IE and FF

HotTag

Archive