你干错用 div+iframe 采用 onmouseover 事件,调用 Ajax 更新那个 div里面的iframe内容好了。
解决方案 »
- 像淘宝及视频之类的大访问量的网站一般带宽在多少
- Wamp apache 启动不了
- php连接mysql
- php写的B/S,想点击链接后把服务器那边数据库里的有关数据导成xls下载下来,求实现方法
- PHP在windows下开发和在linux下面开发有何不同?
- (100分)关于网络安全一个对大家都很有意义的问题!网站后台如何获得来访客户端的唯一标识符,例如网卡Mac地址?
- 请教:我在做一个OA中的一个考勤系统。在数据库的设计上和整个考勤思路是什么样的?
- 在php中,.tpl文件是做什么用的??
- 怎样让下拉菜单(设为MULTIPLE)中多个选项同时选中显示出来。
- PHP_GD_GIF.DLL那里有的下载,还有什么办法让我的PHP4.24支持GIF。
- 为什么这段代码不能读取文件呢
- 求助:linux下git版本库的用法
还是说把鼠标移到title上显示链接地址啊?
确实用onmouseover就O了
还是用div来模拟吧。
这个用title无法放一个html页面的
只有通过DIV来模拟当然除了DIV还有一种span的方法
span处理可能不怎么好看
但是比较容易理解和易写
var titleType=1;//用哪种方式载入title。1/2:startDownload/iframe。startDownload,仅能使用在ie,且不支持跨域
var hiddenType=1;//使用哪种方式隐藏title。1/2:当鼠标离开模拟的title时/当鼠标离开连接时
var titleWidth=150;//title宽度
var titleHeight=250;//title高度
var titleObj;
/*
显示模拟title
*/
function showTitle(titleId,url){
var nowObj=document.getElementById(titleId);
if(nowObj!=titleObj){
if(titleObj){hiddenTitle();}
titleObj=nowObj
} if(titleObj.style.display!=''){
titleObj.style.display='';
}
setTitle(); if(titleObj.style.display==''){
if(hiddenType==1){
titleObj.attachEvent("onmouseout",function(){if(titleObj.contains(event.fromElement)){hiddenTitle()}})
}
else if(hiddenType==2){
event.srcElement.attachEvent("onmouseout",hiddenTitle)
} getTitle(url);
}
}
/*
设置模拟title
*/
function setTitle(){
titleObj.style.position='absolute';
titleObj.style.width=titleWidth+'px'
titleObj.style.height=titleHeight+'px'
titleObj.style.overflow='auto' var tmp_r_wh=JS_getFollowPlace(titleWidth,titleHeight);
titleObj.style.top=tmp_r_wh[1]
titleObj.style.left=tmp_r_wh[0];
}
/*
获得title内容
*/
function getTitle(url){
if(titleType==1){
oDownload.startDownload(url,putData)
}
else if(titleType==2){
putData('<iframe src="'+url+'" marginwidth="1" marginheight="1" scrolling="no" border="0" frameborder="0"></iframe>');
}
}
/*
输出html内容到模拟title中
*/
function putData(data){
titleObj.innerHTML=data
}
/*
隐藏模拟title
*/
function hiddenTitle(){
titleObj.style.display='none';
}/*
获得跟随位置
*/
function JS_getFollowPlace(w,h)
{
var iX,iY
if (window.event.x + w > document.body.offsetWidth - 10)
{
iX = window.event.x - w - 5 ;
}
else
{iX = window.event.x + 5;}
if (iX <0)
{iX=0;} iY = window.event.y;
if (window.event.y + h > document.body.offsetHeight - 10 )
{
iY = document.body.scrollTop + document.body.offsetHeight - h - 5 ;
}
else
{iY = document.body.scrollTop +window.event.y + 5; }
if (iY <0)
{
iY=0;
}
return [iX,iY];
}
</script>
<IE:DOWNLOAD id="oDownload" style="behavior: url(#default#download)"></IE:DOWNLOAD><a href="###" onmouseover="showTitle('titleId','test.htm')">连接</a><!-- <a href="###" onmouseover="showTitle('titleId','http://www.baidu.com/')">连接</a>如果titleType=1 ,将不能跨域,无法获得非当前网站内的html文件 --><br><br><br><br><div id=titleId style="border: 2px solid #FF0000"></div>
楼主【EnginePlus】截止到2008-06-26 17:44:12的历史汇总数据(不包括此帖):
发帖数:11 发帖分:758
结贴数:8 结贴分:508
未结数:3 未结分:250
结贴率:72.73 % 结分率:67.02 %
楼主加油
smarty支持那个tooltip
if ((event.clientY+280) < 500){
$("#abc").css("top",(document.documentElement.scrollTop+event.clientY+10)+"px");
}else{
$("#abc").css("top",(document.documentElement.scrollTop+event.clientY-150)+"px");
}
if(showHelpValue==0){
Polices(type,id,tabletype);
$("#abc").slideDown("fast");
showHelpValue ++;
}
$("#xy").html(event.clientX+','+event.clientY+','+document.getElementById("abc").offsetHeight+','+document.documentElement.scrollTop);
isExe = 1;
}function j_closeHelpTip(){
if(showHelpValue==1){
$("#abc").slideUp("fast");
showHelpValue = 0;
}
}<div class="tipDiv" id="abc">
<div class="tipContent"><span id="Polices_value"></span></div>
</div><tr bgcolor="#DAE9F8" onclick="j_showHelpTip('0001',<!--{$accesslist.ID}-->,'a')" onmouseover="this.style.background='#CCFFCC';" onmouseout="this.style.background='#DAE9F8';j_closeHelpTip()" align="center">
发现一个源代码
不过只支持IE和NN的 谁能修改一下变成也能支持FireFox和Opera啊
代码文件 index.htm 和 pophtm.jsindex.htm 代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT LANGUAGE=JavaScript src="pophtm.js"></SCRIPT>
<script language="JavaScript"><!--
if (IE4)
{
document.write('<div id=popLayer style="position:absolute; z-index:101" class=cPopText></div>');
document.write('<div id=TipBox style="position: absolute; visibility: hidden; padding: 5px; background-Color: #ffffee; filter: alpha(Opacity=90); border: 1px dashed #0099FF; z-index: 99" onMouseover="keepTip()" onMousewheel="keepTip()" ></div>');
}
else if (NN4)
{
document.write('<div id=TipBox style="position: absolute; visibility: hidden; background-Color: #ffffee; filter: alpha(Opacity=90); border: 1px solid #000000; z-index: 99"></div>');
setTimeout('window.onResize=setReload', 500);
}
--></script>
<title>123</title>
<body onclick="hideTip()">
<a onMouseOver="showTip('<table width=50% border=0 cellpadding=0 cellspacing=0> <tr> <th scope=row><IFRAME MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 WIDTH=800 HEIGHT=600 SCROLLING=auto SRC=`http://www.google.com`></IFRAME></th> </tr></table>')" href="http://www.google.com"><font color="">点这里查看效果</font></a>
</body>
pophtm.js 代码如下:
<!--
var bV = parseInt(navigator.appVersion);
var NN4 = document.layers ? true : false;
var IE4 = document.all && bV >= 4 ? true : false;
var downloadID = 0;
var downloadHash = '';
var showClickprogress = 100;
var NowDown=0;function showTip(msg)
{
var obj = 'TipBox';
if (showClickprogress < 100) return; if (typeof(hideTimeOut) != 'undefined') clearTimeout(hideTimeOut);
if (NN4)
{
if (document.layers[obj].visibility != 'visible')
{
with (document[obj].document)
{
open();
write('<layer id=TipBox bgColor=#ffffee style="width: 600px; border: 1px solid #000000" onMouseover="keepTip()" onMousewheel="keepTip()" onMouseout="hideTip()">' + msg + '</layer>');
close();
}
var objp = document.layers.TipBox;
objp.moveTo(100, e.y + 6);
}
document.layers[obj].visibility = 'visible';
}
else if(IE4)
{
if (document.all[obj].style.visibility != 'visible')
{
document.all[obj].innerHTML = msg;
var x = event.x;
var y = event.y;
var objp = document.all.TipBox.style;
//var yy = document.body.scrollTop + y + 6;
objp.pixelLeft = x;
objp.pixelTop =document.body.scrollTop + y-10;
}
document.all[obj].style.visibility = 'visible';
}
}
function keepTip()
{
var obj = 'TipBox';
if (showClickprogress < 100) return; if (typeof(hideTimeOut) != 'undefined') clearTimeout(hideTimeOut);
if (NN4)
document.layers[obj].visibility = 'visible';
else if(IE4)
document.all[obj].style.visibility = 'visible';
}
function hideTip(){
var obj = 'TipBox'; moveFlag=false;
if(NN4){
if(document.layers[obj] != null) document.layers[obj].visibility = 'hidden';
}else if(IE4)
document.all[obj].style.visibility = 'hidden';
}function setReload()
{
window.location.reload();
}
function showDetail(info_hash)
{
var url = info_hash == '' ? 'viewgraph.php' : 'detail.php?info_hash=' + info_hash;
window.open(url, 'detailview', 'scrollbars=yes, width=500, height=300');
}
function GetTorrent()
{
torrentdir = Math.floor(downloadID / 2000);
document.location.href = downloadHash
NowDown=0;
}
function displayClickAD()
{
showClickprogress = 0;
ClickADref = document.all.ClickAD; var scroll_top = document.body.scrollTop;
var docwidth = document.body.clientWidth;
var docheight = document.body.clientHeight;
var ClickADwidth = ClickADref.offsetWidth;
var ClickADheight = ClickADref.offsetHeight;
ClickADref.style.left = docwidth / 2 - ClickADwidth / 2;
ClickADref.style.top = scroll_top + docheight / 2 - ClickADheight / 2; ClickADscroll = setInterval('staticClickADbox()', 50);
ProgressBar = setInterval('controlledhideClickAD()', 400);
ClickADref.style.visibility = "visible";
}
function staticClickADbox()
{
var scroll_top = document.body.scrollTop;
var docheight = document.body.clientHeight;
var ClickADheight = ClickADref.offsetHeight;
ClickADref.style.top = scroll_top + docheight / 2 - ClickADheight / 2;
}
function hideClickADbox()
{
ClickADref.style.visibility = 'hidden';
if (typeof(ClickADscroll) != 'undefined') clearInterval(ClickADscroll);
if (typeof(ProgressBar) != 'undefined') clearInterval(ProgressBar);
document.all.Progress.innerHTML = '<table align=left><tr><td height=5></td></tr></table>';
GetTorrent();
}
function controlledhideClickAD()
{
showClickprogress += 50;
document.all.Progress.innerHTML = '<table width=' + showClickprogress + ' align=left bgColor=green><tr><td height=5><div align=center>正在下载中…</div></td></tr></table>';
if (showClickprogress > 400) hideClickADbox();
}
function DownLoad(id, hash)
{
if (NowDown==0){
NowDown=1;
downloadID = id;
downloadHash = hash;
hideTip();
IE4 ? displayClickAD() : GetTorrent();
}
}-->