|
Posted by MikeB on May 8, 2008, 3:27 pm
Please log in for more thread options > Scripsit MikeB:
>
> > Short question:
> > Can I create a form where the user can simply hit the "1" key on the
> > keyboard and a button click for a specific button on the form is
> > simulated?
>
> That's not a short question, really. And questions don't get any
> shorter, or any simpler, just by calling them "short".
>
I guess we'll just have to differ. I thought that was a short question
that was potentially answerable.
As I get to read about HTML, I realize there seems to be hardly any
issue that is either "short" or "simple", but still, one can hope.
> > As an exercise we had a form that had two input fields and one could
> > press a button and the contents of the two fields would be added
> > together.
>
> Did you do it? URL? The odds are that it is far more important to
> analyze the basic solution than to invent new complexities. So how did
> the page look like when scripting was disabled? Let me guess... a form,
> with a button, and clicking on the button does nothing? No explanation
> anywhere?
I did it. But we don't upload our pages to a server, we simply write
them in NotePad and then open them in IE or FireFox on our own
computers.
The instructor showed us how to register a domain name, but we've not
yet begun to upload any real pages to that.
>
> > I thought it would be interesting to write an entire calcualtor
> > (similar to the one that comes with Windows) as an HTML page.
>
> It would be an exercise in futility, since the calculator would be
> inferior even to the _simple_ (as opposite to "scientific") mode of the
> Windows Calculator.
Of course it is, but I learned something by writing it. I don't think
as a beginner I can start out and only write things that are going to
be better than the existing stuff out there. I think that's
unrealistic.
>
> > I got most of it right, I have buttons and an input field and buttons
> > to do the calculations.
>
> But you didn't learn yet that the way to share your HTML document is to
> upload it on a web server and post the URL?
Unfortunately no.
But I thought, what the heck, I might try it and see if you woulod
offer a useful suggestion.
So here it is: http://fmechess.org/demo/calculator.html
>
> > What I was hoping to do as the cherry on top was to enable it for
> > keyboard access, so a user could press the keys (1, 2, 3 etc.) to
> > enter the values and then the calcualtion key (+, -, *, etc) without
> > having to click on each button.
>
> You can do that, with the usual caveats, using JavaScript. That's
> off-topic here. There's the HTML issue of associating scripts with
> elements, with attributes like onkeypress, but that's really the trivial
> side of the matter (and the details depend on the approach).
>
Yes, I did use JavaScript. That was what the lesson was all about.
> > I found that I could specify access keys in the HTML, but that works
> > weird.
>
> Indeed. So forget them. To begin with, some browsers interpret
> accesskeys as _activating_ a button, some just as _focusing_ on it.
> Accesskey attributes in HTML are widely regarded as a failure, by people
> who have tested the idea and analyzed the design. They are detrimental
> to accessibility, since they may mask out built-in access key
> assignments in browsers and other software.
So "forgetting accesskeys" what else do I use?
>
> > In Firefox, it doesn't seem to work at all.
>
> You did something wrong. Wrong expectations?
Perhaps. I tested the same set of keystrokes as that got some results
in IE.
>
> > In IE, if I press Alt+1, it will cycle through (and enter) either 1,
> > 2, or 3 (the three buttons I've defined accesskey values for).
>
> You did something wrong. Maybe on line 42?
Ha ha... you are too funny. I didn't know the Finnish people has such
an acute sense of humor...
|