...

View Full Version : i need Help calling Sir Vic Philip



paynosaj
10-10-2008, 10:24 AM
hi!
Somebody help me w/ this one, i can't make it work on my site.
I'm just making a selfstudy about javascript.

is there something wrong with this?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Tool Tip Message Clip & AddIFrame</TITLE>
<script language="JavaScript" type="text/javascript">

var zxcOOPCnt=0;
var zxcEvt=0;


function zxcMessageClip(zxcid,zxcspd,zxcopt){
var zxcp=document.getElementById(zxcid);
var zxcopt=zxcopt||'';
zxcopt=zxcopt.toUpperCase();
if (!zxcopt.match('NE')){ zxcAddEvt(zxcp,'zxcExpand','mouseover'); zxcAddEvt(zxcp,'zxcRetract','mouseout'); }
zxcp.oopclip=new zxcOOPMessClip(zxcp,zxcspd,zxcopt);
}

function zxcExpand(zxce,zxcspd){
var zxcobj;
if (typeof(zxce)=='string'){ zxcobj=document.getElementById(zxce); if (!zxcobj){ return; } }
else { zxcobj=this; }
zxcStyle(zxcobj.oopclip.p,{visibility:'visible'});
clearTimeout(zxcobj.oopclip.to);
zxcobj.oopclip.dir=zxcspd||zxcobj.oopclip.spd||1;
zxcobj.oopclip.clip();
}

function zxcRetract(zxce,zxcspd){
var zxcobj;
if (typeof(zxce)=='string'){ zxcobj=document.getElementById(zxce); if (!zxcobj){ return; } }
else {
zxcobj=this;
var zxcto;
if (!zxce) var zxce = window.event;
if (zxce.relatedTarget) zxcto=zxce.relatedTarget;
else if (zxce.toElement) zxcto=zxce.toElement;
while (zxcto.parentNode){
if (zxcto.oopclip){ return; }
zxcto=zxcto.parentNode;
}
}
clearTimeout(zxcobj.oopclip.to);
zxcobj.oopclip.obj.scrollTop=0;
zxcobj.oopclip.dir=-zxcspd||-zxcobj.oopclip.spd||-1;
zxcobj.oopclip.clip();
}

function zxcOOPMessClip(zxcp,zxcspd,zxcopt){
this.p=zxcp;
this.opt=zxcopt;
this.obj=zxcp.getElementsByTagName('DIV')[0];
this.sz=[zxcp.offsetWidth,zxcp.offsetHeight,this.obj.offsetWidth,this.obj.offsetHeight,this.obj.offsetLeft*2, this.obj.offsetTop*2,this.p.offsetLeft,this.p.offsetTop];
this.w=this.sz[0];
this.h=this.sz[1];
this.r=this.sz[3]/this.sz[2];
this.spd=zxcspd;
if (zxcopt.match('AIF')&&window['zxcAddIFrame']){ this.aif=true; }
this.ref='zxcOOPMessClip'+zxcOOPCnt++;
window[this.ref]=this;
this.to=null;
zxcStyle(this.obj,{clip:'rect(0px,'+this.w+'px,'+this.h+'px,0px)'});
zxcStyle(zxcp,{overflow:'visible'});
if (this.opt.match('H')){ zxcStyle(this.p,{ visibility:'hidden'}); }
}

zxcOOPMessClip.prototype.clip=function(){
this.w+=this.dir;
this.h=Math.max(this.w*this.r,this.sz[1]+this.sz[5]/2);
if ((this.dir>0&&this.w&lt;this.sz[2])||this.dir&lt;0&&this.w>this.sz[0]){
zxcStyle(this.obj,{clip:'rect(0px,'+this.w+'px,'+(this.h)+'px,0px)'});
zxcStyle(this.p,{width:(this.w+this.sz[4])+'px',height:(this.h+this.sz[5])+'px'});
if (this.opt.match('C')){ zxcStyle(this.p,{left:(this.sz[6]+(this.sz[0]-this.w)/2)+'px'}); }
else if (this.opt.match('L')){ zxcStyle(this.p,{left:(this.sz[6]+(this.sz[0]-this.w))+'px'}); }
if (this.opt.match('M')){ zxcStyle(this.p,{top:(this.sz[7]+(this.sz[1]-this.h)/2)+'px'}); }
if (this.aif){ zxcAddIFrame(this.p); }

this.setTimeOut('clip();',20);
}
else {
if (this.dir>0){
this.w=this.sz[2];
zxcStyle(this.obj,{clip:'rect(0px,'+this.w+'px,'+(this.sz[3])+'px,0px)'});
zxcStyle(this.p,{width:(this.w+this.sz[4]/2)+'px',height:(this.sz[3]+this.sz[5]/2)+'px'});
}
else {
this.w=this.sz[0];
zxcStyle(this.obj,{clip:'rect(0px,'+this.w+'px,'+(this.sz[1])+'px,0px)'});
zxcStyle(this.p,{left:this.sz[6]+'px',top:this.sz[7]+'px',width:(this.w+this.sz[4]/2)+'px',height:(this.sz[1]+this.sz[5]/2)+'px'});
if (this.opt.match('H')){ zxcStyle(this.p,{ visibility:'hidden'}); }
}
if (this.aif){ zxcAddIFrame(this.p); }
}
}

zxcOOPMessClip.prototype.setTimeOut=function(zxcf,zxcd){
this.to=setTimeout('window.'+this.ref+'.'+zxcf,zxcd);
}

function zxcStyle(zxcele,zxcstyle,zxctxt){
if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
return zxcele;
}

function zxcEventAdd(zxco,zxct,zxcf) {
if ( zxco.addEventListener ){ zxco.addEventListener(zxct, function(e){ zxco[zxcf](e);}, false); }
else if ( zxco.attachEvent ){ zxco.attachEvent('on'+zxct,function(e){ zxco[zxcf](e); }); }
else {
var zxcPrev=zxco["on" + zxct];
if (zxcPrev){ zxco['on'+zxct]=function(e){ zxcPrev(e); zxco[zxcf](e); }; }
else { zxco['on'+zxct]=zxco[zxcf]; }
}
}

function zxcAddEvt(zxc,zxcfun,zxcevt){
zxc['zxcaddEvt'+zxcEvt]=window[zxcfun];
zxcEventAdd(zxc,zxcevt,'zxcaddEvt'+zxcEvt);
zxcEvt++;
}

</script>
</head>


<body bgColor="#f8cd76" onload="InitScripts()" >
<iframe id="zxcTitleIF" src="../Title0.htm" scrolling="no" frameborder="0" style="display:none;overflow:hidden;width:100%;" ></iframe>

<body onload="zxcMessageClip('Test3',5,'M'); >
<div style="position:relative;z-Index:12;width:100px;height:20px;background-color:#FFFFCC;;border:solid black 0px;border-top:0px;border-left:0px;" >
<div id="Test3" style="position:absolute;overflow:hidden;left:0px;top:0px;width:100px;height:30px;background-color:#FFFFCC;" >
<div style="position:absolute;overflow:auto;left:0px;top:0px;width:400px;height:150px;background-color:#FFFFCC;border:solid black 0px;text-align:center;" >
<div style="position:relative;left:10px;top:0px;width:380px;font-size:12px;text-align:left;" >
<div style="position:absolute;left:0px;top:5px;width:150px;font-size:16px;font-weight:bold;" >Add IFrame</div>
<img src="http://www.vicsjavascripts.org.uk/StdImages/Blank.gif" width=100 height=40 align=left >
This script is designed as an 'ADD On' to existing code.<br>
to combat the IE Bug of SelectLists 'shining throught &lt;DIV> Elements<br>
by positioning an &lt;IFRAME> under the &lt;DIV>.<br>
**** Application Notes<br>
<br>
The &lt;DIV> to protect must have its style<br>
visibility, width and height defined inline or class rule.
<br>
The &lt;DIV> object or unique ID name is passed to function zxcAddIFrame(zxcid)<br>
whenever the IFRAME needs to be applied,<br>
that is,<br>
when the &lt;DIV> position size, or visibiliy is modified.<br>
<br>
When the function is initially called,<br>
the initial z-Index of the &lt;DIV> will be increased by one<br>
and an IFRAME sized to the &lt;DIV> size, with the visibility matching the &lt;DIV><br>
will be positioned under the &lt;DIV>.<br>
<br>
Susequent calls will match the IFRAME visibility, size and position to the &lt;DIV>s current states.<br>
<br>
<br>
**** General<br>
<br>
All variable, function etc. names are prefixed with 'zxc' to minimise conflicts with other JavaScripts<br>
These character are easily changed to characters of choice using global find and replace.<br>
<br>
The Functional Code(about 1.2K) is best as an External JavaScript.<br>
<br>
Tested with IE6 and Mozilla FireFox<br>
<br>
</div>
</div>
</div>
</div>

<br />
<b></b><br /><br />
<div style="position:relative;left:10px;top:0px;width:480px;height:160px;text-align:left;border:solid black 0px;;" >
<span onclick="zxcExpand('Test2',1)">Click External Open</span><br />
<br />
<span onclick="zxcRetract('Test2',1)">Click External Close</span><br />
<br />



</body>



</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum