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. Link to comment https://forums.phpfreaks.com/topic/129017-set-focus-on-element/ 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"; Link to comment https://forums.phpfreaks.com/topic/129017-set-focus-on-element/#findComment-670604 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.