chordsoflife Posted October 18, 2008 Share Posted October 18, 2008 I need to set the focus on a particular element without added anything to the body or the head. Is there a way to do that? Here is the code I have to work with: echo "<br /><center><a href='add_concert.php'>Add Another</a></center><br />\n"; I just want to be able to press enter on page load. Quote Link to comment Share on other sites More sharing options...
web_loone_08 Posted October 21, 2008 Share Posted October 21, 2008 you can add an onload() event to the actual body tag; that way it meets your requirements (not in the head or the body - but in the tag instead). <body onload="document.getElementById('focal_link').focus()"> echo "<br /><center><a id='focal_link' href='add_concert.php'>Add Another</a></center><br />\n"; 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.