jd2007 Posted August 7, 2007 Share Posted August 7, 2007 <?php echo "<script> function alert() { alert(document.getElementById('hello').value); } </script> <input id='hello' type='text' value='abc' onclick='alert();' />"; ?> Quote Link to comment Share on other sites More sharing options...
xenophobia Posted August 8, 2007 Share Posted August 8, 2007 3 main problems: 1.) Your function name should not use "alert()". Is a reserved function name. 2.) Try put this in your script tag: <script language="JavaScript" type="text/javascript"> </script> Anyway, is a bad idea to use php to output some javascript. Try find some other way. Happy coding. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.