<html>
<body>
<input type="text" onFocus="javascript:findPosY()"/>
<script type="text/javascript">
eval( function findPosY(){alert("OK");});
</script>
</body>
</html>
While executing above code, eval() function not called and alert is not displayed.
Your code does a double eval. First
evalis used for the inline event handler (which by te way doesn’t need thejavascript:part). Next you try toevalwithin your script tag. As indicated by other answers,evalneeds a string. But in this caseevalling is completely unnecessary. Your snippet should be written like this: