Does anyone happen to know what the optimal way of moving the caret to a given dialog box is? I'd like to arrange it so that when people aren't logged in, and they view a page, the cursor is automatically already in the Username field, and I know there are a variety of ways to do this: what's the best?
I'm considering setting it up so that if you're logged in and view the Posting page, it'll automatically be in the Subject or Message body fields, too, but first thing's first.
Coding Help
I couldn't get getElementById to work, for whatever reason - placement? - so I named the form "credentials," and then used:
Seems to work fine, but is this contraindicated for any reason? Is there any excess code I can take out?
Code: Select all
<script language="Javascript">
<!--
document.credentials.username.focus();
//-->
</script>
Our new fixed headers and footers are neat, to be sure, but they're terribly hacked together. The code is ridiculously untidy, and there are inconsistencies [again] across templates [which are on the list to be fixed]. But my biggest problem is a kludge I'm not very proud of. It's a very 1998 solution to a 2008 problem.
Here's the thing: then you give your header a fixed position, the rest of the page ignores its existence. If your header runs from 0 to 100 pixels, and you fix its position, the body of the page won't start rendering at 101 pixels, it'll start rendering at 0 pixels, and be obscured by the fixed elements. This was actually a problem for a long time over at the d20 SRD, but he's somehow fixed it. I looked over his CSS, and I don't see the solution; I was able to make the header vanish, but I didn't think that was very helpful.
Now, in theory, I could solve the problem by making the body of the page relatively positioned, and pushing it all down by a fixed quantity. The problem here is that I'd have to do it to dozens of pages, or else put the whole body in a table or div that opens in the header and closes in the footer, but when you do that, scrolling the page makes the body scroll so that it's not obscured by the header [so that it's "above" the header, in terms of layers; between the header and the user], and so that user interactions take place on the body layer and not the header layer as one scrolls past the other.
My solution has been a spacer gif that we use for some of the fine-tuning on that image cluster in the upper-left [which wasn't as easy as it looks to make work properly in all browsers]. It's 160 pixels tall, and sits in the header /file,/ but not in the fixed header /table./ It's inelegant, but it works; still, I'd prefer another solution. Anyone?
Here's the thing: then you give your header a fixed position, the rest of the page ignores its existence. If your header runs from 0 to 100 pixels, and you fix its position, the body of the page won't start rendering at 101 pixels, it'll start rendering at 0 pixels, and be obscured by the fixed elements. This was actually a problem for a long time over at the d20 SRD, but he's somehow fixed it. I looked over his CSS, and I don't see the solution; I was able to make the header vanish, but I didn't think that was very helpful.
Now, in theory, I could solve the problem by making the body of the page relatively positioned, and pushing it all down by a fixed quantity. The problem here is that I'd have to do it to dozens of pages, or else put the whole body in a table or div that opens in the header and closes in the footer, but when you do that, scrolling the page makes the body scroll so that it's not obscured by the header [so that it's "above" the header, in terms of layers; between the header and the user], and so that user interactions take place on the body layer and not the header layer as one scrolls past the other.
My solution has been a spacer gif that we use for some of the fine-tuning on that image cluster in the upper-left [which wasn't as easy as it looks to make work properly in all browsers]. It's 160 pixels tall, and sits in the header /file,/ but not in the fixed header /table./ It's inelegant, but it works; still, I'd prefer another solution. Anyone?