[HTML] [UWP] Javascript问题 [英] [HTML][UWP] Javascript problems
问题描述
大家好,
我遇到了VS2015和HTML / JS开发的问题。我已经为Windows 8.1编写了一个带有HTML / JS的应用程序,当我尝试使用相同的系统(例如导航,按钮等)时,它不起作用。所以:我有几个问题。
I'm having a problem with VS2015 and HTML/JS development. I've written an app with HTML/JS for Windows 8.1, and when I try to use the same system (e.g. navigation, buttons etc.) it doesn't work. So: I have a few questions.
1。是否可以使用HTML / JS构建通用Windows应用程序?
1. Is it possible to use HTML/JS to build a Universal Windows app?
2。 Windows 8.1中的条目是否适用于Windows 10?例如,按钮在Windows 8.1和WP8.1中可以正常工作,但在Windows 10中不起作用。示例:
2. Do the entries from Windows 8.1 work in Windows 10? A button, e.g., does work in Windows 8.1 and WP8.1, but it doesn't work in Windows 10. Example:
<button class="win-button">To 001</button>
var myBtn1 = document.getElementById('001')
myBtn1.addEventListener('click', function (event) {WinJS.Navigation.navigate('/001/001.html')}
3.是否存在/是否有适用于Windows 10的Windows 8.x导航应用程序和网格应用程序等模板?
3. Will there be/Are there templates such as the Navigation App and the Grid App for Windows 8.x for Windows 10?
推荐答案
Hello leontesh,
Hello leontesh,
>> 1.是否可以使用HTML / JS构建通用Windows应用程序?
>>1. Is it possible to use HTML/JS to build a Universal Windows app?
是的。 在创建新项目中>>模板>> JavaScript>> Windows>> Windows Universal。
Yes it is. In Create New Project >> Templates >> JavaScript >> Windows >> Windows Universal.
>> 2. Windows 8.1中的条目是否适用于Windows 10?例如,按钮在Windows 8.1和WP8.1中可以正常工作,但它没有在Windows 10中工作。示例:
>> 2. Do the entries from Windows 8.1 work in Windows 10? A button, e.g., does work in Windows 8.1 and WP8.1, but it doesn't work in Windows 10. Example:
它在UWP中有效,但请记住,据我所知,内联JavaScript在UWP中不起作用,因此您的代码应该在外部JavaScript文件中。
It does work in UWP but keep in mind that as far as I know inline JavaScript will not work in UWP so your code should be in external JavaScript file.
<button class="win-button" id="001">To 001</button>
您使用的是文档。
getElementById('001')因此您需要为该按钮指定properid。此外,为了导航工作,您需要具有定义页面导航器类的导航器文件引用。您可以从Windows 8.1商店应用程序中提供
的导航模板中复制粘贴它。
>> 3.是否存在/是否有适用于Windows 10的Windows 8.x导航应用程序和网格应用程序等模板?
>> 3. Will there be/Are there templates such as the Navigation App and the Grid App for Windows 8.x for Windows 10?
是的,他们确实拥有适用于Windows 8.1的Windows应用程序模板。它们应该在In Create New Project>>下模板>> JavaScript>> Windows>> Windows 8
yes they do have Windows app templates for Windows 8.1. They should be under In Create New Project >> Templates >> JavaScript >> Windows >> Windows 8
请参阅:
Windows运行时应用程序的JavaScript项目模板
问候,
Krunal Parekh
Krunal Parekh
这篇关于[HTML] [UWP] Javascript问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!