我正在使用 Tinybox 2 在弹出窗口中显示我的静态 html 页面。问题是我想在那个静态页面中使用 jquery。
这是插件的链接:
http://sandbox.scriptiny.com/tinybox2/
致电:Tinybox:
<a href="#" onclick="TINY.box.show({url:'photos.php?id=<?php echo $result_set['id'];?> ',width:900,height:400})">Read More </a>
照片.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ //this won't work why?
$("#cmdstxt").click(function(){
$("#cmdz").append(" cmds txt");
});
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>HTML</title>
<style>
body {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 10px;
width:900px;
margin:0 auto;
}
html {
overflow-y: auto;
background-color: transparent;
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
height: 30px;
display: block;
background-color: transparent;
}
::-webkit-scrollbar-track-piece {
background-color: #3b3b3b;
-webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:vertical {
height: 50px;
background-color: #666;
border: 1px solid #eee;
-webkit-border-radius: 6px;
}
div#photo{
width:390px;
height:290px;
float:left;
padding:5px;
!background-color:#3B5998;
}
div#about{
width:450px;
height:150px;
overflow: scroll;
overflow-y: scroll;
overflow-x: hidden;
}
div#cmds{
width:400px;
height:300px;
float:right;
border-left: 2px solid black;
}
img{
max-height:150px;
}
.clear{
clear: both;
}
textarea{
width:300px;
}
</style>
</head>
<body>
<?php
require_once("includes/database.php");
if(isset($_GET['id'])){
$id=$_GET['id'];
}
$query="SELECT *
FROM `photo`
WHERE `id` ='${id}' ";
$result=$db->query($query);
$result_set=$db->fetch($result);
?>
<div id="photo">
<h1><?php echo $result_set['title']; ?></h1>
<img src="uploads/<?php echo basename($result_set['path']); ?>" />
<div id="about"><?php echo $result_set['about']; ?></div>
</div>
<div id="cmds">
<div id="cmdz"> </div>
<textarea name="about" id="cmdstxt"></textarea>
</div>
<p class="clear" />
</body>
</html>