Jump to content


Photo

Buttons as Text


  • Please log in to reply
8 replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 20 October 2006 - 10:03 AM

Hey,
How could i change my buttons into TEXT?

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 20 October 2006 - 10:20 AM

Is this what you mean:
<style type='text/css'>
body, button.link_style, input.link_style {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10pt;
}

button.link_style, input.link_style {
	border: 0px;
	padding: 0px;
	cursor: pointer;
	background-color: white;
	color: blue;
	text-decoration: underline;
}
</style>

Click <button type='submit' class='link_style'>here</button> to submit the form


#3 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 20 October 2006 - 12:57 PM

i guess my question is: why?

i'm sure there are ways to style it as you want, like Daniel0 suggested, but there may be better approaches to get your desired result. could you explain what your goal is, and maybe we can help you refine your method a tad.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 20 October 2006 - 04:17 PM

Plus, you should really use input type=button, since BUTTON can break some browsers.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 21 October 2006 - 05:42 PM

i guess my question is: why?

i'm sure there are ways to style it as you want, like Daniel0 suggested, but there may be better approaches to get your desired result. could you explain what your goal is, and maybe we can help you refine your method a tad.


Basically, I wanted a Text Hyperlink instead of a button, but to do the same things as a button; Ie I have a link called Submit, and it submits a form.

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 21 October 2006 - 06:32 PM

If you want to use text to submit the form then do somthing like this:
<a href="#" onclick="document.formNameHere.submit">Submit form

Make sure you give your form an name and change formNameHere to what you named your form as. Or if you only have 1 form on the page use form[0] instead

#7 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 21 October 2006 - 08:30 PM

If you want to use text to submit the form then do somthing like this:

<a href="#" onclick="document.formNameHere.submit">Submit form

Make sure you give your form an name and change formNameHere to what you named your form as. Or if you only have 1 form on the page use form[0] instead


exactly. this way, you can style your link as text instead of having to use negative CSS to remove all the defaults of the button
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#8 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 23 October 2006 - 07:30 PM

If you want to use text to submit the form then do somthing like this:

<a href="#" onclick="document.formNameHere.submit">Submit form

Make sure you give your form an name and change formNameHere to what you named your form as. Or if you only have 1 form on the page use form[0] instead


that didnt work for me :l
I made my form name "loginForm" and used your method it just goes to top of the page.

#9 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 24 October 2006 - 02:53 AM

Should be document.loginForm.submit() -- note the function call.  And strictly speaking, you should have a return false if you don't want the href to be followed, every though submitting the form will make this unnecessary.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users