+ 3
Can someone tell me what this code will do
<img src=x onerror=prompt(2);><script>function remove() { var child = document.getElementById('cmd'); child.parentNode.removechild(child); }
2 Answers
+ 2
This is a piece of a web page. There's an image tag with a 'prompt' javascript function with parameter 2 bound to error event and the "remove" javascript function, that removes an element with id "cmd" from the page. There is no definition of the "prompt" javascript function, so it must be defined elsewhere on the page or in separate .js file, and there is no call of "remove" function in this piece, so it must be called elsewhere on the page and element with id "cmd" should exist elsewhere in the page so this function would do some actual work.
+ 1
The code is meaningless. The function never called and its id is not exist.



