Log in

View Full Version : Getting the cursor to automatically be in the subject field


Gutspiller
07-12-2002, 07:36 PM
So that everytime my users click on reply or post a thread the cursor is already in the subject field, that way all they have to do is type the subject and/or hit tab to post a thread/reply.

I know this is possible and it should be fairly easy. Just something simple that I thought would help a lot of users.

Any help you can give would be appreciated.

Thanks!

Smoothie
07-12-2002, 08:15 PM
I would like to see in the text box for new replies, in the subject box for new threads.

Gutspiller
07-12-2002, 10:25 PM
even better. :)

Birdie501
07-13-2002, 03:26 PM
Hi,

just add this to your template:


function focus(theform) {
document.vbform.XXX.focus();
}


before


</script>
</head>


and replace XXX with the name of the field!

Then
replace

<body>


with:

<body onload="focus()">


:cool:

Smoothie
07-13-2002, 04:47 PM
Compatable with all browsers?

Birdie501
07-13-2002, 04:52 PM
It is javascript, so it should work with all browsers but i can not confirm! Please test it :)

Smoothie
07-13-2002, 04:53 PM
How would you get the number of the subject and text box field?

Logician
07-13-2002, 05:24 PM
it's not number, it's the form field name.. you can find it by checking the source code or relevant template. Eg:

<input type="text" class="bginput" name="title" value="" size="40" maxlength="85" tabindex="1">

name in this field is "title"...(That is subject field of Newreply form)

Smoothie
07-13-2002, 06:10 PM
can't get it to work...:(

Birdie501
07-13-2002, 07:04 PM
well it works for me but the background color of the page is missing?
Does somebody know why?

Gutspiller
07-18-2002, 08:36 PM
Bump

Yes it removes the background for some reason when adding that code.

Gutspiller
07-19-2002, 06:35 PM
bump

Gutspiller
07-26-2002, 04:36 AM
bump