Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-27-2011, 05:19 AM   PM User | #1
samxdesigns
New Coder

 
Join Date: Jul 2011
Location: Canada
Posts: 60
Thanks: 5
Thanked 0 Times in 0 Posts
samxdesigns is an unknown quantity at this point
Question How to make submit button/ Yes or no options.

Hi, im looking to make a <form> with a link to my site, I know how to set the action and stuff and the same with the input's and the id's I just would like to know how to make it so that if you press No, a notification box pops up and says thanks anyways (: and if Yes is pressed A notification box will pop up saying Thanks (: and when pressed ok to exit the notification box, sends you to my site. If you know anything about this, please help. (:
Btw, im just a 13 year old who's been trying to learn basic HTML for the past week so im really new to this stuff. Thanks
samxdesigns is offline   Reply With Quote
Old 07-27-2011, 06:04 AM   PM User | #2
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
an alert box would be javascript
http://www.w3schools.com/js/js_popup.asp
this link will show a button being clicked, then the alert will appear.

javascript is a great language to learn after html/css. It really is pretty simple stuff, and w3schools is a great place to learn the entire language

Last edited by Sammy12; 07-27-2011 at 06:08 AM..
Sammy12 is offline   Reply With Quote
Old 07-27-2011, 11:28 AM   PM User | #3
JustinJD
New Coder

 
Join Date: Jul 2011
Posts: 24
Thanks: 0
Thanked 3 Times in 3 Posts
JustinJD is an unknown quantity at this point
I've written something to what I think you need:

Code:
<script type="text/javascript">
function Yes() {
	var answer = confirm("Thanks (:")
	if (answer){
		<!-- ENTER YOUR SITE HERE -->
		window.location = ("http://www.google.com");
	}
}
function No() {
		alert("Thanks Anyway (:");
	}
</script>
<form>
<input type="button" onclick="Yes()" value="Yes">
<input type="button" onclick="No()" value="No">
</form>
Correct me if I'm wrong.. You may need to move these things around a bit to fit your actual website, but that's the general idea.
JustinJD is offline   Reply With Quote
Users who have thanked JustinJD for this post:
samxdesigns (07-27-2011)
Old 07-27-2011, 11:47 AM   PM User | #4
vikram1vicky
Regular Coder

 
Join Date: Jul 2011
Location: India
Posts: 496
Thanks: 3
Thanked 57 Times in 56 Posts
vikram1vicky is an unknown quantity at this point
Following is the code, you have to add in your page in <script>...</script> tags

Code:
<script>
function Nopressed() 
{
          alert("Thanks anyway!!!");
         window.open("http://www.mysite.com","_self");
}


function Yespressed() 
{
          alert("Thanks!!!");
}
</script>
vikram1vicky is offline   Reply With Quote
Users who have thanked vikram1vicky for this post:
samxdesigns (07-27-2011)
Old 07-27-2011, 04:19 PM   PM User | #5
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
I think you should let him learn how to do it himself instead of giving him the code...how does he learn now that you have given the question?
Sammy12 is offline   Reply With Quote
Old 07-27-2011, 05:47 PM   PM User | #6
JustinJD
New Coder

 
Join Date: Jul 2011
Posts: 24
Thanks: 0
Thanked 3 Times in 3 Posts
JustinJD is an unknown quantity at this point
He said he's learning basic HTML. He may well want to learn Javascript, but I'm not going to assume that, am I?

You're not helping him AT ALL, so I don't think you should be the one criticizing.
JustinJD is offline   Reply With Quote
Old 07-27-2011, 05:49 PM   PM User | #7
samxdesigns
New Coder

 
Join Date: Jul 2011
Location: Canada
Posts: 60
Thanks: 5
Thanked 0 Times in 0 Posts
samxdesigns is an unknown quantity at this point
Thanks everyone
samxdesigns is offline   Reply With Quote
Old 07-27-2011, 05:51 PM   PM User | #8
samxdesigns
New Coder

 
Join Date: Jul 2011
Location: Canada
Posts: 60
Thanks: 5
Thanked 0 Times in 0 Posts
samxdesigns is an unknown quantity at this point
Quote:
Originally Posted by JustinJD View Post
He said he's learning basic HTML. He may well want to learn Javascript, but I'm not going to assume that, am I?

You're not helping him AT ALL, so I don't think you should be the one criticizing.
I tried making a javascript for something a couple months back but failed because I had rushed into it, I would like to learn javascript eventually after Learning CSS too.
Any tips for CSS/Javascript?
samxdesigns is offline   Reply With Quote
Old 07-27-2011, 05:56 PM   PM User | #9
JustinJD
New Coder

 
Join Date: Jul 2011
Posts: 24
Thanks: 0
Thanked 3 Times in 3 Posts
JustinJD is an unknown quantity at this point
I'm always glad to help out!

Yeah, Sammy12 did make a valid point saying that you should learn yourself instead of me giving you the code, but I'm not going to sit here and teach you everything there is to know about Javascript, HTML and CSS, and I assumed you wanted an immediate solution to your problem.

A few tips:
Learn HTML, Then CSS and then Javascript (That's what I did, and it was easy)

Use w3schools.com and read through in the order of first tip.

Try and work out your own problems by using Google, Changing Code etc. (Unless you get really stuck, if so, come back here! )

Hope I helped.
JustinJD is offline   Reply With Quote
Old 07-27-2011, 06:03 PM   PM User | #10
samxdesigns
New Coder

 
Join Date: Jul 2011
Location: Canada
Posts: 60
Thanks: 5
Thanked 0 Times in 0 Posts
samxdesigns is an unknown quantity at this point
Quote:
Originally Posted by JustinJD View Post
I'm always glad to help out!

Yeah, Sammy12 did make a valid point saying that you should learn yourself instead of me giving you the code, but I'm not going to sit here and teach you everything there is to know about Javascript, HTML and CSS, and I assumed you wanted an immediate solution to your problem.

A few tips:
Learn HTML, Then CSS and then Javascript (That's what I did, and it was easy)

Use w3schools.com and read through in the order of first tip.

Try and work out your own problems by using Google, Changing Code etc. (Unless you get really stuck, if so, come back here! )

Hope I helped.
You helped alot, I changed the values to the word's I wanted and that's about all. Also, I did use w3schools.com for learning my HTML basic's, I found it really detailed and had lots of examples. As for learning CSS and Javascript, that has been my plan. I just have 1 question.
What knowledge of HTML would I need to learn CSS?
Thanks,
Sam

Last edited by samxdesigns; 07-27-2011 at 06:05 PM.. Reason: Forgot caps in <b> and <u> tags.
samxdesigns is offline   Reply With Quote
Old 07-27-2011, 06:06 PM   PM User | #11
JustinJD
New Coder

 
Join Date: Jul 2011
Posts: 24
Thanks: 0
Thanked 3 Times in 3 Posts
JustinJD is an unknown quantity at this point
HTML is a very basic language.
I learnt CSS after I knew how to do tables, forms, text and insert images. So I wasn't very experienced at all! :P

CSS takes over a lot of HTML variables, but HTML is still very important!
JustinJD is offline   Reply With Quote
Old 07-27-2011, 06:10 PM   PM User | #12
samxdesigns
New Coder

 
Join Date: Jul 2011
Location: Canada
Posts: 60
Thanks: 5
Thanked 0 Times in 0 Posts
samxdesigns is an unknown quantity at this point
Quote:
Originally Posted by JustinJD View Post
HTML is a very basic language.
I learnt CSS after I knew how to do tables, forms, text and insert images. So I wasn't very experienced at all! :P

CSS takes over a lot of HTML variables, but HTML is still very important!
Ok, thanks man (:

+ I have had a bit of trouble trying to get images into my pages,
I have tried (sorry but I don't know how to put into a little text box)
<img border="0" src="coolpic.jpg" alt="Samxdesigns" width="32" height="32" />
But it always show's up as a blank image, I think I might have made a mistake but I don't see it.
Sam
samxdesigns is offline   Reply With Quote
Old 07-27-2011, 06:12 PM   PM User | #13
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
Quote:
Originally Posted by JustinJD View Post
He said he's learning basic HTML. He may well want to learn Javascript, but I'm not going to assume that, am I?

You're not helping him AT ALL, so I don't think you should be the one criticizing.
how so? I gave him the link to his answer. he will just copy the code you provided into his document. not learning much? maybe the link to w3schools will give him the idea of javascript and furthermore, the ability to build upon it. gear the user to the right direction. users should not be thinking that if i post a question, everyone will just write the code for me.

everyone just wants the answer on a silver platter, but in the end it's the ones who learned how it got there who will succeed.
Sammy12 is offline   Reply With Quote
Old 07-27-2011, 06:15 PM   PM User | #14
samxdesigns
New Coder

 
Join Date: Jul 2011
Location: Canada
Posts: 60
Thanks: 5
Thanked 0 Times in 0 Posts
samxdesigns is an unknown quantity at this point
Quote:
Originally Posted by Sammy12 View Post
how so? I gave him the link to his answer. he will just copy the code you provided into his document. not learning much? maybe the link to w3schools will give him the idea of javascript and furthermore, the ability to build upon it. gear the user to the right direction. users should not be thinking that if i post a question, everyone will just write the code for me.

everyone just wants the answer on a silver platter, but in the end it's the ones who learned how it got there who will succeed.
You have a point there, I have no knowledge of Javscript though.
I was asking just for a bit of code that I did not know to add to my code.
Is there any harm in that?
I understand you want me to learn how to do stuff myself but sometimes I just need a little help from a more successful and experienced coder.
samxdesigns is offline   Reply With Quote
Old 07-27-2011, 06:27 PM   PM User | #15
JustinJD
New Coder

 
Join Date: Jul 2011
Posts: 24
Thanks: 0
Thanked 3 Times in 3 Posts
JustinJD is an unknown quantity at this point
I'm gonna put this out here - We're all right, we all make valid points.
Agree to disagree, we don't want to start a flame war.
JustinJD is offline   Reply With Quote
Reply

Bookmarks

Tags
submit

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:11 PM.


Advertisement
Log in to turn off these ads.