<!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 i开发者_开发知识库d="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>
Make from scratch using a div is too costly, because you need to implement all the handling of dialog (drag, drop, close) You can use an gui lib, like jQuery UI, or an jquery plugin.
精彩评论