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.
Results 1 to 5 of 5

Thread: Prompt windows

  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prompt windows

    Hello, I hope someone can help here.

    Im trying to create a prompt window that when the user types into it, it will have to calculate something. For ex, typing in a quantity of an item that is labeled at a certain dollar amount, and once that is typed in, it will then return the answer to the user.
    This is what i have so far.
    [CODE]
    <script type="text/javascript">
    <!--
    var salesPersons = prompt("Salespersons name : ", "your name here");

    result = window.prompt(Here, 45);
    var quantityOne = prompt( "Quantity of each item sold: ", "Number of item 1 sold");
    [CODE]

    Thanks for any help. I cannot find an answer anywhere

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    prompt is a degugging tool and should not be used in live web pages



    You should be using a form in the page itself to collect the information.

    Or is this homework for a history of JavaScript class where you are being taught the way JavaScript used to be written way back in the 20th Century when Netscape was the most proular browser and 3/4 of the current JavaScript commands didn't exist?
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,334
    Thanks
    11
    Thanked 587 Times in 568 Posts
    Quote Originally Posted by felgall View Post
    way back in the 20th Century when Netscape was the most proular browser and 3/4 of the current JavaScript commands didn't exist?
    just curious, what commands?
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Quote Originally Posted by rnd me View Post
    just curious, what commands?
    All the DOM commands for a start - for example:

    getElementById
    getElementsByClass,
    createElement
    firstChild
    normalize
    insertBefore
    querySelectorAll
    cssTezt

    etc. (the above are only a very small sample)

    Plus lots of others including:

    postMessage
    pushState
    geolocation
    addEventListener
    removeEventListener
    XMLHttpRequest
    JSON.parse
    localStorage

    Of course it was the fact that the DOM commands were not supported that was the reason why JavaScript had to be written completely differently for Netscape than it is for more modern browsers.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    iBall, thanks so much for the help!

    I really appreciate your time to help me on this

    Thanks


  •  

    Posting Permissions

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