javascript - Android - Jquery Mobile - 按钮通过警报框显示

标签 javascript android html jquery-mobile

我的应用程序是使用 HTML、Javascript 和 Jquery Mobile 编写的。

在我的 HTML 页面上,我有一个 <a href>调用打开自定义警报框的 Javascript。我还在页面上使用了几个 Jquery Mobile 元素,例如按钮和 slider 。当调用时,这些元素位于我的警报框顶部。

知道如何让我的警报框在调用时获得完全焦点吗?

这是一些代码:

索引.html:

<a href="javascript:Alert()">Click Here</a>

<div id="AlertBox" class="alert" style="display:none" onClick="document.getElementById('AlertBox').style.display='none'">Message Here</div>

Javascript:

function DisplayAlert(id,left,top) {
document.getElementById(id).style.left=left+'px';
document.getElementById(id).style.top=top+'px';
document.getElementById(id).style.display='block';
}

function Alert() {
var something = false;
if(something) {
}
else {
   DisplayAlert('AlertBox',100,50);
   }
}

最佳答案

1) 没有 jQuery Mobile - 您上面开始的内容,这里有一个类似的讨论:

jQuery: How can i create a simple overlay?

2) 并且您也可以仅使用 jQuery Mobile 完成对话框,如下所示:

<a href="content.html" data-rel="dialog">Open dialog</a> 

文档: http://jquerymobile.com/demos/1.0b2/#/demos/1.0b2/docs/pages/page-dialogs.html

关于javascript - Android - Jquery Mobile - 按钮通过警报框显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7263909/

相关文章:

javascript - jQuery 选择器没有注册添加的类

javascript - 调用 Date() 构造函数时是否可以显式省略参数?

javascript - 创建 'readable' JSON 格式

java - Android 中完全控制的线程队列

java - Android 重定向(返回代码 302)处理

html - 如果 Fixed div 溢出,则设置页面滚动以显示内容

css - 具有溢出自动的绝对定位 div 导致子绝对 div 被切断

JavaScript 参数对象不具有所有参数

android - 如何从 android 设备获取 android 应用程序 traces.txt 文件

javascript - 代码可以在 jsfiddle 中运行,但不能在 html 文件中运行