Cazpa.com PHP Developer & Website Designer

9Feb/1025

Javascript Tutorial – 5 – Prompt

visit www.thenewboston.com for all my tutorials!

No related posts.

About Daniel Smith

I am the boss around here, if you need anything then send me a message :))

Popular Content & Keywords

depositfiles hack,add update delete in php,warning: mail() [function mail]: smtp server response: 554 the message was rejected because it contains prohibited virus or spam content in,php tutorial deutsch,php define variable,rails vs php performance,,php add update delete,add update delete records from sql server using php,warning: mail() [function mail]: smtp server response: 554 the message was rejected because it contains prohibited virus or spam content,tutorial create contact form in dreamweaver php,ruby on rails vs php 2010,facebook jsonwrapper,php tutorial // user registration w/ sql,send emails with a web form: php scripting
Comments (25) Trackbacks (1)
  1. do u know how to work java script for SAM Broadcaster 3

  2. how do you make a regular message to the use without the “script prompt to do it?

  3. it doesn’t seem to work if you use +

  4. use this:

    alert (Number(num1) + Number(num2));

    should work fine…

  5. Hey, i find your videos really helpful. thanks alot

  6. What’s to keep the user from entering a string of text instead of a number?

  7. actually if you type alert (num1*num2);
    alert (num1+num2);
    alert (num1/num2);

    what it dows is that it gives you the results for the adition because we put a + sing and division because we also put a / sing

    its preatty awsome

  8. well threre are some bugs im working on because when you actually type the second sector of coding lines for example
    the first line lets make it: var num1=prompt(num—-blalalblal
    but then when you try to repeat the same code but with difrent sing for example / division / multiplication * or any other sing it give syou false numbers im try to fix it so that way all bugs will be gone lol and hey keep up the good work nice vids by th way

  9. keep doin wat ur doing.Its really helping.
    Thanks alot

  10. Thanks

  11. your website is down

  12. its just like a video now?

  13. Mike Jones lol

  14. Wow, you make things MUCH easyier! I rated and subscribed!

  15. I’m taking a course and I don’t know what the hell my teacher is doing. But you make sense. Thanks.

  16. if you type (num1+num2);

    it puts the two number together like 1 + 1 = 11

  17. That’s if num1 and num2 are strings. If you want to add the numbers in strings you can do: parseInt(num1)+parseInt(num2)

  18. That was some awesome vid you had!

  19. Im working on a question game that uses prompt and alerts so I need to watch JavaScript.

    P.S
    Your tutorials on JavaScript are the best!!!!

  20. It alsow uses if else statements

  21. hey u r amaizing person
    god bless u and ur family

    but what is notepad++
    i have normal one and i want to get the same software u have.

  22. your tutorials are the best, but 1+1 is 11…how could i solve that problem? thanks in advance..God Bless..

  23. @Chopinsiblos.

    You are using the + operator in ur variable that is why you are getting 11, it is just adding 1 to 1, you want to use the * operator.

  24. the prompt returns the message as a type “string”. So it treats the input the same way as it would text. You cant “add” strings, the + operator concatenates them, adding them to the end of each other. To output the sum of 1 + 1, you need to state that they are of number types.

  25. try this…

    var num1 = parseInt(prompt(”Enter num1″));
    var num2 = parseInt(prompt(”Enter num2″));
    var answer = (num1 + num2);
    alert(answer);

    now the input is “parsed” as an integer rather than a string. Google javascript to string for more information.


Leave a comment

You must be logged in to post a comment.

Powered by WordPress Lab