0

oneError event example(javascript)

<!DOCTYPE html> <html> <head> <script> onerror = handleErr; var txt = ""; function handleErr(msg, url, l) { txt = "There was an error on this page.\n\n"; txt += "Error: " + msg + "\n"; txt += "URL: " + url + "\n"; txt += "Line: " + l + "\n\n"; txt += "Click OK to continue.\n\n"; alert(txt); return true; } function message() { alertMe("Welcome guest!"); } </script> </head> <body> <input type="button" value="View message" onclic

7th Nov 2016, 6:04 PM
De Ve Ce
De Ve Ce - avatar
1 Answer
0
I dont know exactly what do you want to do, but i have here an example: i have this img: <img src="fjjdidkd" onerror="test(event)"> Oh, my img has an invalid src: ERROR. in test func goes all the things that will alert the user. search how to do it on w3schools.com, for example.
13th Nov 2016, 12:25 AM
Pytness
Pytness - avatar