[英]How can a link open a window in same page using JQuery? It works in Javascript as shown
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Open Div from Link</title>
<script src="http://code.jquery.com/jquery-1.4.4.js"></script>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<style type="text/css">
/*<![CDATA[*/
body
{
background-color:#aaaaff;
}
#one
{
position:absolute;
top:80px;
left:40px;
}
object
{
width:980px;
height:660px;
border:solid 1px #000000;
}
/*//]]>*/
</style>
<script language="javascript" type="text/javascript">
//<![CDATA[
// written by: Coothead
function updateObjectIframe(which) {
document.getElementById('one').innerHTML = '<'+'object id="foo" name="foo" type="text/html" data="'+which.href+'"><\/object>';
}
//]]>
</script>
</head>
<body>
<div id="one">
<object id="foo" name="foo" type="text/html" data="http://www.w3schools.com/"></object>
</div>
<div>
<a href="http://www.google.com" onclick="updateObjectIframe(this); return false;">Retreive Existing Records</a>
</div>
</body>
</html>
使用div从头开始制作的成本太高,因为您需要实现对话框的所有处理(拖动,拖放,关闭)。您可以使用gui lib(如jQuery UI或jquery插件)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.