Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have visual studio express 2013 and i have this Html and javascript code here:
HTML
<html>
    <head>
        <title>Calculator</title>
    </head>
    <body>
        <h1>Adding in Progress...</h1>
        <h3>Your Answer:
        </h3>        
    <script>
        var Add = prompt("Please enter example");
    </script>
        
        <form name="Homepage button" action="/default.html">
    <input type="submit" value="Back">
    </form>
            
    </body>
</html>

so it tells me this when i run it:

Unhandled exception at line 11, column 9 in ms-appx://06545e30-f1ab-4a87-bbfb-e7ee24a7e6ec/page_js/Adding_Calculator_js.html

0x800a1391 - JavaScript runtime error: 'prompt' is undefined


What does this mean i need a way to fix it or else my App will have to go down without it.!!!
Posted

This problem has nothing to do with Visual Studio.

Apparently, you did not define the function prompt. But why?

Your whole approach to the calculator is already wrong. JavaScript calculator is a really simple thing. Everything is already done for you in JavaScript itself.

You should never prompts anything, ever. Instead, you should have a Web page with some standard controls.

Provide a text area element for the user to put any JavaScript expressions. It could be virtually any JavaScript code valid in any context. The, one some event (for example, on some button), you should get the property value of this control and call JavaScript function eval(string) with this value:
http://www.w3schools.com/jsref/jsref_eval.asp[^].

Then you should output result somewhere.

Look at the example on the page referenced above. No, you should not required the user to write any output like document.write. You should have some variable calculating result of evaluation and show the result in some other HTML element.

—SA
 
Share this answer
 
v3
ok you see im making a win 8 app ok'
and a know some javascript i use ormpt to take a number and again another number 2 vars and
then i add them together.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900