我正在尝试在应用栏中设置一个登录按钮,一旦我点击它,就会出现(弹出)登录。我试过了:html:
<!-- APPBAR -->
<div id="appbar" data-win-control="WinJS.UI.AppBar" data-win-options="{layout:'custom',placement:'top'}">
<button data-win-control="WinJS.UI.AppBarCommand" data-win-options="{id:'cmdLog', label:'Login/Logout', icon:'placeholder',section:'global',flyout:select('#loginFlyout')}" type="button"></button>
</div>
<!-- APPBAR FLYOUT -->
<div id="loginFlyout" data-win-control="WinJS.UI.Menu">
<form id='register' method='post'
accept-charset='UTF-8'>
<fieldset>
<legend>Login</legend>
<label for='username'>UserName:</label>
<input type='text' name='username' id='username' maxlength="50" />
<label for='password'>Password:</label>
<input type='password' name='password' id='password' maxlength="21" />
<input type='button' name='Submit' onclick="logincheck()" value='Submit' />
</fieldset>
</form>
</div>
我得到了这个:
JavaScript运行时错误:WinJS.UI._Overlay.MustContainCommands:无效的HTML:AppBars / Menus必须只包含AppBarCommands / MenuCommands
我猜我不能有<form .../>
。这有解决方法吗?或任何建议,非常感谢。
答案 0 :(得分:0)
我忘记了WinJS.UI.Menu的样子,但你考虑过使用SettingsFlyout,还是创建自己的ModalDialog?