本帖最后由 【錯愛號】 于 2010-10-18 14:27 编辑
回复 sunlinanb46 的帖子
- <a onclick="showDialog('document.write('html代码写这里'); 'info', '帮助', null, 1)" href="javascript:;">点击我看看</a>
复制代码
?????????是这样吗
你把下面的保存为HTML文件 浏览下效果 上面有字 也有复制地址 我套的就是这样的效果 怎么用到DZ里
这个我已经用到里面了 可代码太多 想借用DZ本身的弹出 来做出这个效果
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>div弹出层</title>
<style type="text/css">
*{ margin:0px; padding:0px;}
body{
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
}
.CityBox{
padding:15px;
clear:both;
color:#333;
border:5px solid #ccc;
width:520px;
height:180px;
background:#fff;
overflow-y:scroll;
scrollbar-shadow-color: #ffffff;
scrollbar-highlight-color: #ffffff;
scrollbar-face-color: #d9d9d9;
scrollbar-3dlight-color: #d9d9d9;
scrollbar-darkshadow-color: #d9d9d9;
scrollbar-track-color: #ffffff;
scrollbar-arrow-color: #f30
}
.CloseDiv{
float:right;
color:#fff;
text-decoration:none;
margin-right:20px;
width:100px;
text-align:right;
}
.CloseDiv a{ color:#000; text-decoration:none}
.LCnormaltab{ background:#000;display:block; color:#fff;}
.LChovertab{ background:#fff; color:#000;display:block;}
.LCdis{display:block;}
.LCundis{display:none;}
</style>
</head>
<body>
<a id="togglecity2" href="#">点击我2</a>
<div id="citycont2" style="display:none;">
<div id="clearcity1" onclick='city_clearDiv()' class="CloseDiv"><a href="#">关闭</a></div>
<div class="CityBox">
<div class="heading">
<h3>把豆单贴到我的博客或BBS</h3><div id="clearcity2" onclick='city_clearDiv()' class="CloseDiv"><a href="#">关掉我</a>
</div>
<div class="container">
<table>
<tr><th>HTML代码:</th><td><input keyid="2" value='<embed src="http://www.tudou.com/l/l7nGwGo-SAA" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="400"></embed>' id="clipHTML" size="53" class="text"/></td><td><input type="button" keyid="3" class="submit" value="复制" /></td></tr>
<tr><th></th><td colspan="2">贴到 <em>MSN space</em>、<em>新浪博客</em></td></tr>
<tr><th>FLASH代码:</th><td><input keyid="7" value="http://www.tudou.com/l/l7nGwGo-SAA" id="clipPlayer" size="53" class="text"/></td><td><input keyid="8" type="button" class="submit" value="复制" /></td></tr>
<tr><th></th><td colspan="2">贴到 <em>Blogbus</em>、<em>51.com</em>、<em>搜狐</em>、<em>网易</em>、<em>QQ日志</em>、<em>pcpop</em>、<em>I贴吧</em></td></tr>
<tr><th>播放页地址:</th><td><input keyid="4" value="http://www.tudou.com/playlist/playindex.do?lid=10485639" id="clipURL" size="53" class="text"/></td><td><input keyid="5" type="button" class="submit" value="复制" /></td></tr>
<tr><th></th><td colspan="2">贴到 <em>开心</em>、<em>人人</em>、<em>豆瓣</em>、<em>QQ空间</em>、<em>白社会</em>、<em>新浪微博</em>、<em>百度空间</em></td></tr>
</table>
</div>
</div>
</div>
<script type="text/javascript">
//控制弹出层的ID ,数字为改变弹出层的DIV
toggleCity("togglecity2","citycont2","clearcity2",600,400);
//---------------------主要部分------------------------------
//activeObj:触发时间的元素id
//contObj:要显示内容的id
//clearObj:清除显示层的id
//newDivWidth:显示层的宽度
//newDivHeight:显示层的高度
function toggleCity(activeObj,contObj,clearObj,newDivWidth,newDivHeight){
var ocity=document.getElementById(activeObj);
var citycont=document.getElementById(contObj);
var oclearcity=document.getElementById(clearObj);
ocity.onclick=function(){findselect();city_createDiv(citycont,newDivWidth,newDivHeight);}
}
function findselect(){//查找并隐藏select
var oselect=document.getElementsByTagName("select");
if(oselect.length>0){
for(var i=0;i<oselect.length;i++){
oselect.style.display="none";
}
}
}
function showselect(){//显示select
var oselect=document.getElementsByTagName("select");
if(oselect.length>0){
for(var i=0;i<oselect.length;i++){
if(oselect.style.display=="none"){
oselect.style.display="inline";
}
}
}
}
function owinWidth(){//当前窗口的width
var winWidth;
if (window.innerWidth){
winWidth = window.innerWidth;
}
else if ((document.body) && (document.body.clientWidth)){
winWidth = document.body.clientWidth;
}
if (document.documentElement && document.documentElement.clientWidth){
winWidth = document.documentElement.clientWidth;
}
return winWidth;
}
function owinHeight(){//当前窗口的height
var winHeight;
if (window.innerHeight){
winHeight = window.innerHeight
}else if ((document.body) && (document.body.clientHeight)){
winHeight = document.body.clientHeight
}
if (document.documentElement && document.documentElement.clientHeight){
winHeight = document.documentElement.clientHeight;
}
return winHeight;
}
function city_createDiv(pinner,newDivWidth,newDivHeight){//创建背景
var obody=document.body;
document.documentElement.style.overflowY="auto";
document.documentElement.style.overflowX="hidden";
var newDiv=document.createElement("div");
newDiv.id="bgdiv";
var winWidth=owinWidth();
var winHeight=owinHeight();
if(obody.offsetWidth>winWidth){
newDiv.style.width=obody.offsetWidth+"px";
}else{
newDiv.style.width=winWidth+'px';
}
if(obody.offsetHeight>winHeight){
newDiv.style.height=obody.offsetHeight+"px";
}else{
newDiv.style.height=winHeight+'px';
}
newDiv.style.background="#000";
newDiv.style.position="absolute";
if(typeof(newDiv.style.filter)=="string"){
newDiv.style.filter="alpha(opacity=60)";
}else{
newDiv.style.opacity="0.3";
}
newDiv.style.top=0;
newDiv.style.left=0;
var newP=city_createP(winWidth,winHeight,newDivWidth,newDivHeight);
if(pinner){
newP.innerHTML=pinner.innerHTML;
}
obody.appendChild(newDiv);
obody.appendChild(newP);
}
function city_createP(winWidth,winHeight,newDivWidth,newDivHeight){//创建显示层
var obody=document.body;
var newP=document.createElement("div");
newP.id="contdiv";
newP.className="book_new_p";
newP.style.width=newDivWidth+"px";
newP.style.height=newDivHeight+"px";
newP.style.position="absolute";
//newP.style.background="#fff";
newP.style.top=(winHeight-newDivHeight)/2+"px";
newP.style.left=(winWidth-newDivWidth)/2+"px";
return newP;
}
function city_clearDiv(){//清除生成背景和容器层
var bgd=document.getElementById("bgdiv");
var contd=document.getElementById("contdiv");
document.body.removeChild(contd);
document.body.removeChild(bgd);
document.documentElement.style.overflowY="auto";
showselect();
}
</script>
</body>
</html>
|