Javascript 将弹出窗口放在屏幕底部(而不是浏览器窗口底部)
我的问题是。如何在屏幕底部(而不是浏览器窗口底部)弹出一个窗口 我应该使用哪个属性?Webkit通知? 如果您正在查找Webkit通知,请使用以下内容:Javascript 将弹出窗口放在屏幕底部(而不是浏览器窗口底部),javascript,html,css,popup,Javascript,Html,Css,Popup,我的问题是。如何在屏幕底部(而不是浏览器窗口底部)弹出一个窗口 我应该使用哪个属性?Webkit通知? 如果您正在查找Webkit通知,请使用以下内容: <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title>Desktop Notifications</title> <sc
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Desktop Notifications</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
function checkNotifications() {
if (window.webkitNotifications)
alert("Notifications are supported!");
else
alert("Notifications are not supported for this Browser/OS version yet.");
}
function createNotificationInstance(options) {
if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED
if (options.notificationType == 'simple') {
return window.webkitNotifications.createNotification('icon.png', 'Notification Title', 'Notification content...');
} else if (options.notificationType == 'html') {
return window.webkitNotifications.createHTMLNotification('http://localhost/');
}
} else {
window.webkitNotifications.requestPermission();
}
}
</script>
<style type="text/css">
* {font-family: Verdana, sans-serif;}
body {font-size: 10pt; margin: 0; padding: 0;}
p {margin: 5px;}
a {color: #09f; text-decoration: none;}
a:hover {color: #f00;}
</style>
</head>
<body>
<p><strong>Desktop Notifications</strong></p>
<p>Lets see how the notifications work in this browser.</p>
<p>
<a href="#" onclick="checkNotifications(); return false;">Check Notification Support</a>.
Next <a href="#" onclick="alert('Notifications are ' + ((window.webkitNotifications.checkPermission() == 0) ? '' : 'not ') + 'allowed!'); return false;">Check Notification Permissions</a>
and if permissions are not there,
<a href="#" onclick="window.webkitNotifications.requestPermission(); return false;">Request Permissions</a>.
Create a
<a href="#" id="text">Simple Notification</a>
or
<a href="#" id="html">HTML Notification</a>.
</p>
</body>
<script type="text/javascript">
document.querySelector("#html").addEventListener('click', function() {
if (window.webkitNotifications.checkPermission() == 0) {
createNotificationInstance({ notificationType: 'html' });
} else {
window.webkitNotifications.requestPermission();
}
}, false);
document.querySelector("#text").addEventListener('click', function() {
if (window.webkitNotifications.checkPermission() == 0) {
createNotificationInstance({ notificationType: 'simple' }).show();
} else {
window.webkitNotifications.requestPermission();
}
}, false);
</script>
</html>
桌面提醒
函数checkNotifications(){
if(window.webkit通知)
警报(“支持通知!”);
其他的
警报(“此浏览器/操作系统版本尚不支持通知”);
}
函数createNotificationInstance(选项){
如果(window.webkitNotifications.checkPermission()==0){//0是否允许权限
如果(options.notificationType=='simple'){
返回window.webkitNotifications.createNotification('icon.png','Notification Title','Notification content…');
}else if(options.notificationType==“html”){
返回窗口.webkitNotifications.createHTMLNotification('http://localhost/');
}
}否则{
window.webkitNotifications.requestPermission();
}
}
*{字体系列:Verdana,无衬线;}
正文{字体大小:10pt;边距:0;填充:0;}
p{margin:5px;}
a{color:#09f;文本装饰:无;}
a:悬停{color:#f00;}
桌面通知
让我们看看通知在此浏览器中的工作方式
.
下一个
如果没有权限,
.
创建一个
或
.
document.querySelector(“#html”).addEventListener('click',function(){
if(window.webkitNotifications.checkPermission()==0){
createNotificationInstance({notificationType:'html'});
}否则{
window.webkitNotifications.requestPermission();
}
},假);
document.querySelector(“#text”).addEventListener('click',function(){
if(window.webkitNotifications.checkPermission()==0){
createNotificationInstance({notificationType:'simple'}).show();
}否则{
window.webkitNotifications.requestPermission();
}
},假);
截图
注意:这只适用于Chrome和其他基于WebKit的浏览器。。。有关更多信息,请参见Webkit通知?
如果您正在查找Webkit通知,请使用以下内容:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Desktop Notifications</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
function checkNotifications() {
if (window.webkitNotifications)
alert("Notifications are supported!");
else
alert("Notifications are not supported for this Browser/OS version yet.");
}
function createNotificationInstance(options) {
if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED
if (options.notificationType == 'simple') {
return window.webkitNotifications.createNotification('icon.png', 'Notification Title', 'Notification content...');
} else if (options.notificationType == 'html') {
return window.webkitNotifications.createHTMLNotification('http://localhost/');
}
} else {
window.webkitNotifications.requestPermission();
}
}
</script>
<style type="text/css">
* {font-family: Verdana, sans-serif;}
body {font-size: 10pt; margin: 0; padding: 0;}
p {margin: 5px;}
a {color: #09f; text-decoration: none;}
a:hover {color: #f00;}
</style>
</head>
<body>
<p><strong>Desktop Notifications</strong></p>
<p>Lets see how the notifications work in this browser.</p>
<p>
<a href="#" onclick="checkNotifications(); return false;">Check Notification Support</a>.
Next <a href="#" onclick="alert('Notifications are ' + ((window.webkitNotifications.checkPermission() == 0) ? '' : 'not ') + 'allowed!'); return false;">Check Notification Permissions</a>
and if permissions are not there,
<a href="#" onclick="window.webkitNotifications.requestPermission(); return false;">Request Permissions</a>.
Create a
<a href="#" id="text">Simple Notification</a>
or
<a href="#" id="html">HTML Notification</a>.
</p>
</body>
<script type="text/javascript">
document.querySelector("#html").addEventListener('click', function() {
if (window.webkitNotifications.checkPermission() == 0) {
createNotificationInstance({ notificationType: 'html' });
} else {
window.webkitNotifications.requestPermission();
}
}, false);
document.querySelector("#text").addEventListener('click', function() {
if (window.webkitNotifications.checkPermission() == 0) {
createNotificationInstance({ notificationType: 'simple' }).show();
} else {
window.webkitNotifications.requestPermission();
}
}, false);
</script>
</html>
桌面提醒
函数checkNotifications(){
if(window.webkit通知)
警报(“支持通知!”);
其他的
警报(“此浏览器/操作系统版本尚不支持通知”);
}
函数createNotificationInstance(选项){
如果(window.webkitNotifications.checkPermission()==0){//0是否允许权限
如果(options.notificationType=='simple'){
返回window.webkitNotifications.createNotification('icon.png','Notification Title','Notification content…');
}else if(options.notificationType==“html”){
返回窗口.webkitNotifications.createHTMLNotification('http://localhost/');
}
}否则{
window.webkitNotifications.requestPermission();
}
}
*{字体系列:Verdana,无衬线;}
正文{字体大小:10pt;边距:0;填充:0;}
p{margin:5px;}
a{color:#09f;文本装饰:无;}
a:悬停{color:#f00;}
桌面通知
让我们看看通知在此浏览器中的工作方式
.
下一个
如果没有权限,
.
创建一个
或
.
document.querySelector(“#html”).addEventListener('click',function(){
if(window.webkitNotifications.checkPermission()==0){
createNotificationInstance({notificationType:'html'});
}否则{
window.webkitNotifications.requestPermission();
}
},假);
document.querySelector(“#text”).addEventListener('click',function(){
if(window.webkitNotifications.checkPermission()==0){
createNotificationInstance({notificationType:'simple'}).show();
}否则{
window.webkitNotifications.requestPermission();
}
},假);
截图
注意:这只适用于Chrome和其他基于WebKit的浏览器。。。有关更多信息,请参见
窗口中的屏幕属性。屏幕包含可用高度
和可用宽度
等数据
例如,如何使用这些按钮打开屏幕右下角的弹出窗口:屏幕属性位于窗口中。屏幕
包含可用高度
和可用宽度
等数据
作为如何使用这些按钮打开屏幕右下角的弹出窗口的示例:是否有您想要的屏幕截图?添加了答案。。然后特别注意“不在浏览器窗口底部”的文字。因为您被标记为“javascript/html/c”