Rob,

I work at a university (in Australia) doing what can be best described
as "web front-end construction". Most of our work is for government
and/or educational groups so there are certain guidelines and
regulations that we need to follow.

A submit button is needed because most of the sites we do are required
(as in a legal requirement) to work without JavaScript turned on. If I
were to use just a JavaScript link then obviously there'd be problems.

It also makes building a front end for an existing site a lot easier
as I just need to add a class to the submit button and style the
resulting link. This is especially true on pages with multiple submit
buttons where I don't need to worry about passing back the right value
for the button pressed.

I could just use a normal button but of course our graphic designer
wouldn't be as happy with the possibilities :). (Not to mention Safari
doesn't really allow _any_ styling of buttons.)

I try to use JavaScript as "icing" rather than "required cake". It's
partly about "progressive enhancement", partly about accessibility,
partly about separation of layers (content, look and behavior) and
partly about ease of testability.

The JavaScript link is alright if you have a very limited audience for
your site, where you can guarantee exactly what machines and browsers
are going to be running.

Karl Rudd

On 5/23/07, Rob Desbois <[EMAIL PROTECTED]> wrote:
Karl,
Any particular reason why you would use a link to click the button to
perform the button's task, rather than just disposing of the button and
assigning its task to the link? If that made no sense ;-) take an example:
why create an invisible button to save, then use jQuery to create a link out
of it, when you could just write this:
   <a href="javascript:save()">Save</a>
It removes the need to modify the DOM unnecessarily and also means that the
source HTML shows more closely its final content.

James,
Good question...first assumption would be it varies between browsers.
Offhand I think most do not show the updated source, however a tool such as
Firebug [ http://www.getfirebug.com/] will show the updated DOM instead.
You'd have to test it with your browser to find out for sure.

--rob



 On 5/23/07, james_027 <[EMAIL PROTECTED]> wrote:
>
> Hi rob,
>
> Thanks very much, that really gives me a lot info. I'll take your
> suggestion ...
> Another question ... You mention about the browser to update its DOM
> with $('p').click(...) does this update can be seen when your view the
> source or it is done internally?
>
> Thanks again
> james
>
> On May 22, 10:56 pm, "Rob Desbois" <[EMAIL PROTECTED]> wrote:
> > James,
> >
> > The <button> tag is a different element created to allow much more
control
> > over styling and content - you can include markup such as images and
styling
> > in a <button> tag which is not possible with <input type="button">
> >
> > As for which of the two approaches I prefer - I'd go for <a
> > href="javascript:foo()"> as the javascript IS the link target, creating
an
> > onclick() handler and putting a fake value in the href attribute is to
my
> > mind misusing the tag.
> >
> > Alexandre's approach works - however unless you need to dynamically
assign
> > different click event handlers, I think it is better to put the event
> > handler into the source rather than setting it with jQuery.
> > Why force the browser to update its DOM with  $('p').click(...)  once
the
> > page is loaded when you can set it just by coding the tag? It'll slow
the
> > browser slightly as it updates the page after loading, which is
cumulative
> > if you have to do it for many links/tags.
> >
> > Hope all that info helps!
> > --rob
> >
> > On 5/22/07, james_027 <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > what is the difference between <input type="button"> to <button>
> >
> > > Thanks
> > > james
> > > On May 22, 5:20 pm, Bob den Otter < [EMAIL PROTECTED]> wrote:
> > > > james_027 wrote:
> > > > > Hi,
> >
> > > > > Is this the best way to make a text button?
> >
> > > > > <a href="#">Click Me!</a>
> >
> > > > Slightly offtopic, but you might want to look into this:
> >
>http://particletree.com/features/rediscovering-the-button-element/
> >
> > > > Besides the <button> tag, they also go into styling <a> tags to
resemble
> > > > buttons.
> >
> > > > Best, Bob.
> >
> > --
> > Rob Desbois
> > Eml: [EMAIL PROTECTED]
> > Tel: 01452 760631
> > Mob: 07946 705987
> > "There's a whale there's a whale there's a whale fish" he cried, and the
> > whale was in full view.
> > ...Then ooh welcome. Ahhh. Ooh mug welcome.
>
>



--
Rob Desbois
Eml: [EMAIL PROTECTED]

Tel: 01452 760631
Mob: 07946 705987
"There's a whale there's a whale there's a whale fish" he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.

Reply via email to