简体   繁体   中英

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 UIjquery插件)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM