visual studio JavaScript问题请帮忙!! [英] visual studio JavaScript problem please help!!

查看:70
本文介绍了visual studio JavaScript问题请帮忙!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有visual studio express 2013,我在这里有这个Html和javascript代码:

I have visual studio express 2013 and i have this Html and javascript code here:

<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>



所以当我运行时它会告诉我这个:



ms-appx:// 06545e30第11行第9行未处理的异常-f1ab-4a87-bbfb-e7ee24a7e6ec / page_js / Adding_Calculator_js.html



0x800a1391 - JavaScript运行时错误:'prompt'未定义





这是什么意思我需要一种方法来修复它,否则我的应用程序必须在没有它的情况下才能运行。!!!


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.!!!

推荐答案

此问题与Visual St无关udio。



显然,你没有定义函数提示。但是为什么?



你对计算器的整个方法已经错了。 JavaScript计算器非常简单。一切都已经在JavaScript中完成了。



你永远不应该提示任何东西。相反,你应该有一个带有一些标准控件的网页。



为用户提供一个文本区域元素来放置任何JavaScript表达式。它几乎可以是任何上下文中有效的JavaScript代码。一个事件(例如,在某个按钮上),您应该获得此控件的属性 value 并调用JavaScript函数 eval(string) 使用此值:

http://www.w3schools.com /jsref/jsref_eval.asp [ ^ ] 。



然后你应该在某处输出结果。



查看上面引用的页面上的示例。不,您不应该要求用户写任何输出,如 document.write 。你应该有一些变量计算结果,并在其他一些HTML元素中显示结果。



-SA
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


好的,你看我即赢得8个应用确定'

和一个知道一些javascript我使用ormpt取一个数字再次另一个2号变量和

然后我将它们加在一起。
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.


这篇关于visual studio JavaScript问题请帮忙!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆