Server Side vs Client Side (was: Re: [thelist] cursor positioning with PHP)

Michael Pemberton evolt at
Sat Feb 26 00:29:31 CST 2005

Bernardo Escalona wrote:
> Ok, I want to have the cursor automatically placed in the 'login'
> field of a form as soon as the page loads up.
-- snip --
> I was mostly looking for a way to do this directly from php. Any suggestions?

I apologise in advance if I am jumping to comclusions, but it appears 
that you need to look at the difference between what is possible at the 
server side and what can be done on the client side.

Languages like PHP, ASP, Coldfusion, etc are only able to interact with 
items that are accessible to the server.  These are normally things like 
files and database connections.

If you want to interact with item that are on the clients end, such as 
DHTML elements and CSS values, then it has to be done from within the 
browser.  This means that you may alter the code before it gets to the 
client, but the execution will still be done locally.

In short, the only way that PHP will be needed is if you wanted to allow 
for changing the name of the field to be selected.


function cursor_pos(){
	document.login_form.<?= $fieldname; ?>.focus();
// -->

Hopefully this all makes sense and I haven't created more confusion :)

Michael Pemberton
evolt at

More information about the thelist mailing list