首页 \ 问答 \ javascript alert()函数在UWP应用程序中不起作用(javascript alert() function not working in UWP app)

javascript alert()函数在UWP应用程序中不起作用(javascript alert() function not working in UWP app)

我使用了一些基本的javascript代码并用它来制作一个简单的UWP应用程序,当我在浏览器中运行文件时代码中的警报功能正常工作,但是当我在UWP应用程序中尝试它时它不起作用。 下面是代码

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>App6</title>

<!-- WinJS references -->
<link href="WinJS/css/ui-dark.css" rel="stylesheet" />
<script src="WinJS/js/base.js"></script>
<script src="WinJS/js/ui.js"></script>

<!-- App6 references -->
<link href="/css/default.css" rel="stylesheet" />
<script src="/js/default.js"></script>
</head>
<body class="win-type-body" onload="alert('oh yeah');">

</body>
</html>

I used some little basic javascript code and used it to make a simple UWP app, the alert function in the code works when i run the file in the browser, but it doesnt work when i try it in UWP app. below is the code

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>App6</title>

<!-- WinJS references -->
<link href="WinJS/css/ui-dark.css" rel="stylesheet" />
<script src="WinJS/js/base.js"></script>
<script src="WinJS/js/ui.js"></script>

<!-- App6 references -->
<link href="/css/default.css" rel="stylesheet" />
<script src="/js/default.js"></script>
</head>
<body class="win-type-body" onload="alert('oh yeah');">

</body>
</html>

原文:https://stackoverflow.com/questions/33439818
更新时间:2023-07-22 13:07

最满意答案

那些是不同的Ts。

scala> type T[T] = { def f: T  } 
defined type alias T

scala> var x: T[Int] = null
x: T[Int] = null

scala> x = new AnyRef { def f = 5 }
x: T[Int] = $anon$1@44daa9f1

当你写:

type Addable[Addable] = { def +(a : Addable) : Addable }

你有一个Addable类型的参数,也叫做Addable。 这是人们经常混淆的类似变化。

scala> def f[Int](x: Int) = x * x
<console>:7: error: value * is not a member of type parameter Int
       def f[Int](x: Int) = x * x
                              ^

你的问题的实际答案是“你不能”,但我不愿意粉碎你的宗教信仰,所以我会说“结构类型以神秘的方式工作”。 如果你想参加一个宗教使命,你可能会在这里访问,这就解释了为什么你不能。

http://article.gmane.org/gmane.comp.lang.scala/7013


Those are different Ts.

scala> type T[T] = { def f: T  } 
defined type alias T

scala> var x: T[Int] = null
x: T[Int] = null

scala> x = new AnyRef { def f = 5 }
x: T[Int] = $anon$1@44daa9f1

When you write:

type Addable[Addable] = { def +(a : Addable) : Addable }

You have a type Addable which takes a single type parameter, also called Addable. Here's a similar variation people often confuse themselves with.

scala> def f[Int](x: Int) = x * x
<console>:7: error: value * is not a member of type parameter Int
       def f[Int](x: Int) = x * x
                              ^

The actual answer to your question is "you can't" but I would hate to shatter your religious-like faith so instead I'll say "structural types work in mysterious ways." If you want to go on a religious mission you might visit here, which explains why you can't.

http://article.gmane.org/gmane.comp.lang.scala/7013

相关问答

更多
  • 那些是不同的Ts。 scala> type T[T] = { def f: T } defined type alias T scala> var x: T[Int] = null x: T[Int] = null scala> x = new AnyRef { def f = 5 } x: T[Int] = $anon$1@44daa9f1 当你写: type Addable[Addable] = { def +(a : Addable) : Addable } 你有一个Addable类型的参 ...
  • 第二个链接给出了一个在js中类似鸭子的模式的例子。 不是说我建议这样做,但是好的,你问了这个。 ;) 在面向对象编程语言的计算机编程中,鸭型打字是一种动态打字的风格,其中对象的当前方法和属性集确定有效语义,而不是从特定类或特定接口的实现继承。 维基百科 - 鸭打字 最简单的方法是非正式地定义合同,并且只需依靠接口每一侧的开发人员知道他们在做什么。 戴维·托马斯(Dave Thomas)把这种方式称之为“鸭子打字” - 如果它像鸭子一样走,像鸭子一样,那么它就是一只鸭子。 类似于我们的Shape界面,如果它可 ...
  • 这是一种用于动态语言的术语,没有强力打字 。 这个想法是,您不需要一种类型来调用对象上的现有方法 - 如果在其上定义了一种方法,则可以调用它。 这个名字来自“如果看起来像鸭子,像鸭子一样,这是一只鸭子”。 维基百科有更多的信息。 It is a term used in dynamic languages that do not have strong typing. The idea is that you don't need a type in order to invoke an existing ...
  • 也许不需要输入鸭子,因为CLOS并不遵循消息传递原则,而且方法也不会被绑定到类上。 情况正是如此。 每个泛型函数都可以动态地专门针对某个类。 也可以有一个默认的实现。 而且由于Lisp使用动态类型,每个函数都可以用任何类型的参数调用,而对于泛型函数,基于参数类型的调度决策在运行时会被采用。 Perhaps duck-typing is not needed because CLOS doesn't follow a message passing philosophy and methods are not ...
  • 您可以使用F#PowerPack中的组件编译F#引用。 所以我认为你可以使用引号在运行时生成和执行代码。 如果你编写一个代表函数的引用并编译它,你将获得一个可用于实现接口的函数值。 这是一个简单的例子: #r "FSharp.PowerPack.Linq.dll" open Microsoft.FSharp.Quotations open Microsoft.FSharp.Linq.QuotationEvaluation // Create a part using "Expr." calls expli ...
  • 任何动态类型的oop语言都支持duck-typing,包括php。 它不是一个功能,而是编程风格。 Any dynamically-typed oop language supports duck-typing, including php. It's not a feature, it's rather programming style.
  • 即使您没有像评论中暗示的那样“为其他开发人员开发代码”,编码到接口也有很多好处。 讨论这些好处是值得的,但由于问题要求现实世界的例子/用例,这里有: 供测试用。 IoC可以很容易地引入模拟和其他简化/测试类,这些类允许测试特定单元,而无需将项目的所有依赖项纳入其中。 用于在某些依赖项可用之前实现应用程序的特定部分。 (类似于测试用例) 为不同用户提供不同的功能集。 您可以拥有给定模块的多个“版本”,并将适当的模块提供给不同类型的客户:评估版,标准版,高级版甚至Beta测试版。 只要模块的API得到尊重,应用 ...
  • 这很俗气: scala> def test(x: { def x(a:Int, b:Int):Int ; def x$default$2: Int } ) = x.x(1, x.x$default$2) warning: there were 2 feature warning(s); re-run with -feature for details test: (x: AnyRef{def x(a: Int,b: Int): Int; def x$default$2: Int})Int scala> v ...
  • 没有明确的答案; 这取决于你的课程做什么。 检查你的Hero.equip isinstance(weapon, Weapon)以检查该物品是否是武器并不是那么可怕。 此外,如果您要像第二个示例中那样涉及两个对象,则可以将更多处理移动到Hero中: class Hero: def __init__(self): self.weapon = None self.inTummy = None def equip(self, weapon): pri ...
  • 这是一个圆椭圆问题 。 我不会覆盖这个功能; 相反,我会将函数重命名为更具体。 所以在AppleBasket中将它重命名为getRandomApple()。 你的语义变得有些混乱,所以我会把事情分开并且更加清晰。 你不能在FruitBasket中更改函数名称太糟糕了,因为我会将其更改为getRandomFruit()以使语义更清晰。 This is a circle-ellipse problem. I would simply not override the function; rather I wou ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)