Skip to content

Yay – Focusing on Bagels for a Minute

October 12, 2014

At the Vintage Computer Festival I got Dave Ruske to sit down with the Bagels server. It worked fine but he consistently ran into the same annoyance that I had. When the form is displayed the focus is not in the text box so if you try to just type your next guess, it goes into never never land – you have to click in the text box to give it focus and re-type your guess. I came across this post that describes how to use the OnLoad attribute of the HTML body tag to give an element focus. I’m not sure it will work with every browser but it does in Chrome so I’m encouraged. It might not be obvious but the cursor is in the text field in the image below.
14-10-12 bagels

The page source now looks like:


<html><body OnLoad="document.mf.G.focus();"><span style="color:#0000A0">
<center><h1>Olduino 1802 BAGELS Server</h1></center>Your Guess Was: 123  I say Pico <P><p><form name="mf" method="GET">
<input type="text" name="G"><input type="submit" value="Enter Your Guess">
</form><a href="http://goo.gl/p4C0Cg">Olduino</a>: An Arduino for the First of Us<p></body></html>

I use short names wherever I can just to cut down on the data traffic. The goo.gl blah blah is a goole-shortened url for this blog.

Advertisements

From → web server

One Comment
  1. Hi Bill,
    That’s some good old fashioned JavaScript and it should work in pretty much every browser going back for quite some time.

    Andrew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: