/    Sign up×
Community /Pin to ProfileBookmark

button: how to make a link?

hi there

I’ve got a true newby-question: if I have a common button like:

[CODE]<button name=”buttonName” type=”button”>My button</button>[/CODE]

I would like to make now a simple link with this button to another site. I also have a form-button (submit) next to it, this I know so far how it works. But how can I make a cummon button to do something?

Thanks for any help
Oliver

to post a comment
HTML

8 Comments(s)

Copy linkTweet thisAlerts:
@substanceJan 17.2007 — Here's a simple one:

[CODE]<FORM>
<INPUT TYPE="BUTTON" VALUE="Link" ONCLICK="www.yourlinkhere.com/index.html">
</FORM>[/CODE]
Copy linkTweet thisAlerts:
@CharlesJan 17.2007 — You have three ways:

1) Use JavaScript. Very yucky and it tends to not work. Do not use this method for a public web page.

2) Put the thing in its own FORM. Just use the FORM's "action" attribute as you would the A element's "href".

3) Style an A element so that it looks like a button. See http://www.w3.org/TR/REC-CSS2/ui.html#system-colors .
Copy linkTweet thisAlerts:
@mc_hammerauthorJan 17.2007 — thank you for you answer (first answer). It doesn't work though... I copied your example in an empty html-file, nothing happens when I press the button. Guess it won't work that way.
Copy linkTweet thisAlerts:
@mc_hammerauthorJan 17.2007 — 2) Put the thing in its own FORM. Just use the FORM's "action" attribute as you would the A element's "href".[/QUOTE]

thank you for your answer. I already use another button which represent the submit-button of my form. I thought it would be nice to use simple buttons for other functions (without yuckie JS, hehe) since I design them anyhow with CSS. So it seems the only way is to design a button-like look with CSS?
Copy linkTweet thisAlerts:
@substanceJan 17.2007 — forget the last one I did total rubbish, sorry.

This one uses the Form action like Charles says:

[CODE]<form action="http://www.yourlink.com" method="link">
<input type=submit value="link">
</form>[/CODE]
Copy linkTweet thisAlerts:
@CharlesJan 17.2007 — So it is not possible as it seems?[/QUOTE]Sure it is, make an A element look like a button.

And don't use type "link" with a FORM. That's just some more nonsense that somebody made up.
Copy linkTweet thisAlerts:
@mc_hammerauthorJan 17.2007 — Sure it is, make an A element look like a button.[/QUOTE]

sorry I've overread this one - so it is only possible to do it with CSS, which 'simulates' a button ?

well, let's see ?

And don't use type "link" with a FORM. That's just some more nonsense that somebody made up.[/QUOTE]

I would say either POST or GET ?
Copy linkTweet thisAlerts:
@mc_hammerauthorJan 17.2007 — ok I'm stucked little bit now. I decided to use two Submit-Buttons instead. They would reside in the same form and call the same php-script when pressed:

[code=php]<form id="FormName" action="myPage.php" method="post" name="FormName">
<button name="button1" value="Button1" type="submit">Button 1</button>
<button name="button2" value="Button2" type="submit">Button 2</button>
</form>[/code]


From what variable (POST) can I read now in my php-script which button has been pressed?

thx for any help!

oliver
×

Success!

Help @mc_hammer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...