Android - Jquery Mobile - Buttons通过Alert Box显示

时间:2011-08-31 21:52:28

标签: javascript android html jquery-mobile

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

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

任何想法如何让我的警报框在被叫时完全集中注意力?

以下是一些代码:

的index.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 个答案:

答案 0 :(得分:2)

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