Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

asked on

Javascript alert not functioning.

index.htm


See attached HTML. Note on line 25, iuser="y". Note on the body tag, the onLoad event. Note the Javascript function chk_is_user() (on line 42). Note test on line 54.


The alert does not appear. This code used to work, I have others similar, they don't work now either. using Chrome browser.


What causes this?


Thank you

Avatar of leakim971
leakim971
Flag of Guadeloupe image

https://www.tabnine.com/blog/inline-javascript-in-html/
https://www.google.com/search?q=recommanded+inline+javascript
<script type="text/javascript">
isuser = "y";
pc = "";
pr = "";
ac = "";
nl = "";
bad = "";
window.addEventListener("DOMContentLoaded", chk_vals); // https://developer.mozilla.org/fr/docs/Web/API/Window/DOMContentLoaded_event
function chk_vals() {

Open in new window

and remove the inline one
<body>

Open in new window

Avatar of Richard Korts

ASKER

Applied code, I believe you meant chk_is_user as the function, not chk_vals.

Does not work, see attached code.

index_new.html

Does the function name need the () at the end?
maybe you had too much popup and your web browser proposed you to deactivate them
That is not an answer. It needs to work in all browsers.

Somebody else?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect Julian.

I guess you found that in Chrome debugger, don't know why I didn't think of that.

Richard