Using CSS link/button to submit a form without javascript?
Posted: Fri Aug 27, 2010 10:26 am
I'm using CSS to dynamically generate graphical buttons, like this:
results in
,
and similarly, results in 
So it's not just a static image (actually it consists of two parts: I have one small image for the left border, and one wide image which I use as background, right-aligned so it fits in - all common CSS trickery).
Now here's a problem. Sometimes I use buttons not just as normal links, but to submit a form. Currently I can only pull this off by using javascript:
Works fine, except search bots can't follow this because now the link does not have a normal URL anymore.
Is there an alternative way to do this, without javascript, so that search bots understand the destination of this button (i.e. the form action), as is the case with normal <input type='submit'> buttons ?
I know the <button> tag, but does that allow me to completely restyle / replace the default html button with my own? Then there's <input type='image'> but as far as I understand that only works with static images. While my button images are dynamic, containing text, generated using CSS.
Is there some way to use another tag, which can submit a form (recognizable by search engines) and be CSS'ed into custom dynamic buttons like I'm doing with <a>?
Code: Select all
<a href='somewhere' class='myButton'>bla</a>
,and similarly,
Code: Select all
<a href='somewhere' class='myButton'>something</a>
So it's not just a static image (actually it consists of two parts: I have one small image for the left border, and one wide image which I use as background, right-aligned so it fits in - all common CSS trickery).
Now here's a problem. Sometimes I use buttons not just as normal links, but to submit a form. Currently I can only pull this off by using javascript:
Code: Select all
<a href='javascript:document.forms["myForm"].submit()' class='myButton'>click me plz!</a>Is there an alternative way to do this, without javascript, so that search bots understand the destination of this button (i.e. the form action), as is the case with normal <input type='submit'> buttons ?
I know the <button> tag, but does that allow me to completely restyle / replace the default html button with my own? Then there's <input type='image'> but as far as I understand that only works with static images. While my button images are dynamic, containing text, generated using CSS.
Is there some way to use another tag, which can submit a form (recognizable by search engines) and be CSS'ed into custom dynamic buttons like I'm doing with <a>?