Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Coder
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    60
    Thanks
    5
    Thanked 0 Times in 0 Posts

    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

  • #2
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    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 07:08 AM.

  • #3
    New Coder
    Join Date
    Jul 2011
    Posts
    24
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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.

  • Users who have thanked JustinJD for this post:

    samxdesigns (07-27-2011)

  • #4
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    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>

  • Users who have thanked vikram1vicky for this post:

    samxdesigns (07-27-2011)

  • #5
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    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?

  • #6
    New Coder
    Join Date
    Jul 2011
    Posts
    24
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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.

  • #7
    New Coder
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    60
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thanks everyone

  • #8
    New Coder
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    60
    Thanks
    5
    Thanked 0 Times in 0 Posts
    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?

  • #9
    New Coder
    Join Date
    Jul 2011
    Posts
    24
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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.

  • #10
    New Coder
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    60
    Thanks
    5
    Thanked 0 Times in 0 Posts
    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 07:05 PM. Reason: Forgot caps in <b> and <u> tags.

  • #11
    New Coder
    Join Date
    Jul 2011
    Posts
    24
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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!

  • #12
    New Coder
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    60
    Thanks
    5
    Thanked 0 Times in 0 Posts
    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

  • #13
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    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.

  • #14
    New Coder
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    60
    Thanks
    5
    Thanked 0 Times in 0 Posts
    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.

  • #15
    New Coder
    Join Date
    Jul 2011
    Posts
    24
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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.


  •  
    Page 1 of 2 12 LastLast

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •