The website I'm working on will not scroll until somewhere on a page is clicked with the mouse or 'tabbed' through with the tab key.
Is there a simple answer I am over looking?
EDIT- Okay here is a simple bit of javascript I need help with.
I put this bit at the end of the existing javascript file being called
function setFocus() {
document.getElementById("#realBody").focus() ;
}
I put this bit(just the onload part) in the main php file
</head>
<body class="<?php print $classes; ?>" onload="setFocus()">
<div id="realBody">
This isn't working, if this simple code is usable I'd love some pointers.
I am trying to draw focus to realBody
Perhaps you are focusing on a text field or dropdown menu, and your input (scrolls) are tied to that one control? Are you explicitly calling Focus() on one of the controls on the page?
remove the hash mark '#'.
Or if your using jQuery
$(function() {
$('#realBody').focus();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With