内容简介:翻译自:https://stackoverflow.com/questions/15459107/how-do-you-open-a-url-in-a-dialog-box-jquery-ui
).计划是稍后动态添加URL,以便我的站点中的所有链接都将显示在所述窗口中.
我尝试了以下操作,但单击链接时对话框窗口为空.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script>
$(document).ready(function() {
$('#openwindow').each(function() {
var $link = $(this);
var $dialog = $('<div></div>')
.load($link.attr('href'))
.dialog({
autoOpen: false,
title: $link.attr('title'),
width: 500,
height: 300
});
$link.click(function() {
$dialog.dialog('open');
return false;
});
});
});
</script>
</head>
<body>
<a id="openwindow" href="http://www.google.com">Click me to test.</a>
</body>
</html>
我找到了一些例子,但没有一个真正奏效.我真的很感激一些帮助.
提前致谢.
上的文档.
相反,您需要在.open属性上加载内容 –
$( "#openwindow" ).dialog({
open: function(event, ui) {
$('#divInDialog').load('test.html', function() {
alert('Load was performed.');
});
}
});
此外,您似乎使用带有id的.each – id应该在页面中是唯一的.请改用类.
翻译自:https://stackoverflow.com/questions/15459107/how-do-you-open-a-url-in-a-dialog-box-jquery-ui
以上所述就是小编给大家介绍的《如何在对话框JQUERY UI中打开URL》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- Android进度对话框
- 使用导航组件: 对话框目的地
- VBScript - 弹出“文件选择对话框”方法大全!
- jQuery实现定时隐藏对话框的方法分析
- 使用React手写一个对话框或模态框
- c# – Watin – 使用ConfirmDialogHandler处理确认对话框
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Getting Real
Jason Fried、Heinemeier David Hansson、Matthew Linderman / 37signals / 2009-11-18 / USD 24.99
Getting Real details the business, design, programming, and marketing principles of 37signals. The book is packed with keep-it-simple insights, contrarian points of view, and unconventional approaches......一起来看看 《Getting Real》 这本书的介绍吧!
随机密码生成器
多种字符组合密码
HTML 编码/解码
HTML 编码/解码