...

View Full Version : How to make submit button/ Yes or no options.



samxdesigns
07-27-2011, 06:19 AM
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 :)

Sammy12
07-27-2011, 07:04 AM
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

JustinJD
07-27-2011, 12:28 PM
I've written something to what I think you need:



<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.

vikram1vicky
07-27-2011, 12:47 PM
Following is the code, you have to add in your page in <script>...</script> tags



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


function Yespressed()
{
alert("Thanks!!!");
}
</script>

Sammy12
07-27-2011, 05:19 PM
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?

JustinJD
07-27-2011, 06:47 PM
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.

samxdesigns
07-27-2011, 06:49 PM
Thanks everyone :)

samxdesigns
07-27-2011, 06:51 PM
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? :)

JustinJD
07-27-2011, 06:56 PM
:) 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 (http://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! :D)

Hope I helped. :)

samxdesigns
07-27-2011, 07:03 PM
:) 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 (http://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! :D)

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

JustinJD
07-27-2011, 07:06 PM
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!

samxdesigns
07-27-2011, 07:10 PM
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:)

Sammy12
07-27-2011, 07:12 PM
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.

samxdesigns
07-27-2011, 07:15 PM
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.

JustinJD
07-27-2011, 07:27 PM
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. :)

samxdesigns
07-27-2011, 07:44 PM
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. :)

Agreed man. :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum