#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    Accepting both lower and upper case


    I have this code but I need to be able to input either lower case or upper case and get a result. For example I want to enter history and get back History Book and also enter HISTORY and get back History Book. I

    Can someone help.


    Here is my code.
    <html>
    <head>
    <title>Untitled</title>
    <script type="text/javascript">
    <!--
    function show_prompt()

    {
    var book=prompt("Enter a book");



    if(book == "history" ){
    document.write("<b>History Book</b>");
    }else if( book == "maths" ){
    document.write("<b>Maths Book</b>");
    }else if( book == "economics" ){
    document.write("<b>Economics Book</b>");
    }else{
    document.write("<b>Unknown Book</b>");
    }
    }

    //-->
    </script>
    </head>

    <body>



    <input type="button" onclick="show_prompt()" value="click here to find out the book you need" />
    </body>
    </html>
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Feb 2004
    Location
    Mobile, Alabama
    Posts
    4,023
    Rep Power
    1285
    you need to ask this in the javascript forum

IMN logo majestic logo threadwatch logo seochat tools logo