The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Why are my buttons not working correctly?
ironpastry
post Mar 22 2019, 11:49 AM
Post #1





Group: Members
Posts: 1
Joined: 22-March 19
Member No.: 26,858



I have to make a website for a school project. My buttons were working correctly but then I tried to put them in a line and now if you go to the website you cannot leave the homepage(cookingforcollege.net). Can someone tell me why and how to fix it? Thanks!

Code:
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
</head>
<body>
<center style="color:red;font-size:40px;">Cooking For College</center>
<style>
form { display: inline; }
</style>
<form action="/index.html" method="get" >
<button type="submit">Home</button>
<method="get" action="/breakfast.html">
<button type="submit">Breakfast</button>
<method="get" action="/lunch.html">
<button type="submit">Lunch</button>
<method="get" action="/dinner.html">
<button type="submit">Dinner</button>
<method="get" action="/about.html">
<button type="submit">About</button>
</form>


</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 22 2019, 01:12 PM
Post #2


.
********

Group: WDG Moderators
Posts: 8,239
Joined: 10-August 06
Member No.: 7



Each button needs its own form, each with a different URL in the ACTION attribute.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 22 2019, 06:45 PM
Post #3


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,403
Joined: 9-August 06
Member No.: 6



Yeah. With a start and end tag. You can't put the attributes (action and method) in their own tag as you've done.

That said, this isn't a good method. Use real links. Style them to look as buttons if you wish.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 22 2019, 07:00 PM
Post #4


.
********

Group: WDG Moderators
Posts: 8,239
Joined: 10-August 06
Member No.: 7



QUOTE(pandy @ Mar 23 2019, 12:45 AM) *

You can't put the attributes (action and method) in their own tag as you've done.

Oops, didn't notice that part.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Mar 22 2019, 07:30 PM
Post #5


Programming Fanatic
********

Group: Members
Posts: 1,672
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Not to mention that <style> goes in the <html> section not the <body>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th October 2019 - 10:51 PM