PDA

View Full Version : event handler problems


theanthill
07-12-2002, 12:14 AM
I have an understanding of the event handler and using more than one script on a page including using it successfully.

The script that is causing me problems is: //Vertical Scroller v1.2- by Brian of www.ScriptAsylum.com located at http://www.javascriptkit.com/script/script2/verticalscroller.shtml.

I have found the window.open=function() and there is another function just before in the script window.resize=function() I can't seem to write this script correctly into the event handler to get all my scripts to work together.

Looking through this script I simply don't know what to put into the event handler so it understands to run this script with the others. I also don't know what to change in the script itself to make it cooperate. Deleting window.open= and putting the function() into the event handler stops the script and everything else.

Any ideas?
:)

Here is the code. The code for the scroller is not written in the event handler simply because it screws everything up. I am not sure how to post the code or single out the right stuff. This is a bunch, but here it goes:

<html>
<HEAD>

<script>
<!--


if (window!= top)
top.location.href=location.href
// -->
</script>



<!-- ImageReady Preload Script (Anthony Top Corner.jpg) -->
<SCRIPT LANGUAGE="JavaScript">

<!--


function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
Anthony_Top_Corner_01_over = newImage("Ant%20Corner%20pic/images/Anthony-Top-Corner_01-over.jpg");
preloadFlag = true;
}
}
// End -->
</script>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=540,height=450,left = 140,top = 50');");
}
// End -->
</script>


<SCRIPT LANGUAGE="JavaScript">

image2 = new Image();
image2.src = "Ant%20Home%20Icon%20shadow.jpg";

image4 = new Image();
image4.src = "written%20proffer%20icon%20shadow.jpg";

image5 = new Image();
image5.src = "weaverworks%20icon%20shadow.jpg";

image6 = new Image();
image6.src = "email%20icon%20shadow.jpg";

image7 = new Image();
image7.src = "links%20icon%20shadow.jpg";



// End -->
</script>
<!-- End Preload Script -->
</head>


<meta http-equiv="Content-Language" content="en-us">
<title>artproffers - anthillproffers</title>
<body link="#000080" vlink="#808080" alink="#FF0000">

<div align="center">
<center>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="605" cellpadding="0" height="584">
<tr>
<td width="104" height="1" align="center" style="border-right-style: none; border-right-width: medium">



<BODY BGCOLOR=#FFFFFF ONLOAD="preloadImages()";"javascript:popUp()";>




<!-- ImageReady Slices (Anthony Top Corner.jpg) -->
<a title="Ant on his visual art"> <a href="javascript:popUp('antonart.htm/')";
ONMOUSEOVER="changeImages('Anthony_Top_Corner_01', 'Ant%20Corner%20pic/images/Anthony-Top-Corner_01-over.jpg'); return true;"
ONMOUSEOUT="changeImages('Anthony_Top_Corner_01', 'Ant%20Corner%20pic/images/Anthony-Top-Corner_01.jpg'); return true;">
<IMG NAME="Anthony_Top_Corner_01" SRC="Ant%20Corner%20pic/images/Anthony-Top-Corner_01.jpg" BORDER=0 width="116" height="96"></A>
<!-- End ImageReady Slices -->
</body>


<tr>

<td>
<script language="javascript">

//Vertical Scroller v1.2- by Brian of www.ScriptAsylum.com
//Updated for bug fixes
//Visit JavaScript Kit (http://javascriptkit.com) for script

//ENTER CONTENT TO SCROLL BELOW.
var content='<font face="Courier New" size="2"><font color="#000080"><p><b><center><u>artproffers </font></u><u><font color="#FF0000">UPDATES</font></u></p><p><u>concepts</u> - <u> series</u> -</b><font color="#808080">brand new pieces as of <u>07-15-02</u></p></font><p><font color="#000080"><b>Click below on <u>concepts</u> or <u>series</u> to <font color="#FF0000"><b><u>check \'em out!</u></b></p></center></font>';

var boxheight=95; // BACKGROUND BOX HEIGHT IN PIXELS.
var boxwidth=105; // BACKGROUND BOX WIDTH IN PIXELS.
var boxcolor="#FFFFFF"; // BACKGROUND BOX COLOR.
var speed=50; // SPEED OF SCROLL IN MILLISECONDS (1 SECOND=1000 MILLISECONDS)..
var pixelstep=2; // PIXELS "STEPS" PER REPITITION.
var godown=false; // TOP TO BOTTOM=TRUE , BOTTOM TO TOP=FALSE

// DO NOT EDIT BEYOND THIS POINT

var outer,inner,elementheight,ref,refX,refY;
var w3c=(document.getElementById)?true:false;
var ns4=(document.layers)?true:false;
var ie4=(document.all && !w3c)?true:false;
var ie5=(document.all && w3c)?true:false;
var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;
var txt='';
if(ns4){
txt+='<table cellpadding=0 cellspacing=0 border=0 height='+boxheight+' width='+boxwidth+'><tr><td>';
txt+='<ilayer name="ref" bgcolor="'+boxcolor+'" width='+boxwidth+' height='+boxheight+'></ilayer>';
txt+='</td></tr></table>'
txt+='<layer name="outer" bgcolor="'+boxcolor+'" visibility="hidden" width='+boxwidth+' height='+boxheight+'>';
txt+='<layer name="inner" width='+(boxwidth-4)+' height='+(boxheight-4)+' visibility="hidden" left="2" top="2" >'+content+'</layer>';
txt+='</layer>';
}else{
txt+='<div id="ref" style="position:relative; width:'+boxwidth+'; height:'+boxheight+'; background-color:'+boxcolor+';" ></div>';
txt+='<div id="outer" style="position:absolute; width:'+boxwidth+'; height:'+boxheight+'; visibility:hidden; background-color:'+boxcolor+'; overflow:hidden" >';
txt+='<div id="inner" style="position:absolute; visibility:visible; left:2px; top:2px; width:'+(boxwidth-4)+'; overflow:hidden; cursor:default;">'+content+'</div>';
txt+='</div>';
}
document.write(txt);

function getElHeight(el){
if(ns4)return (el.document.height)? el.document.height : el.clip.bottom-el.clip.top;
else if(ie4||ie5)return (el.style.height)? el.style.height : el.clientHeight;
else return (el.style.height)? parseInt(el.style.height):parseInt(el.offsetHeight);
}

function getPageLeft(el){
var x;
if(ns4)return el.pageX;
if(ie4||w3c){
x = 0;
while(el.offsetParent!=null){
x+=el.offsetLeft;
el=el.offsetParent;
}
x+=el.offsetLeft;
return x;
}}

function getPageTop(el){
var y;
if(ns4)return el.pageY;
if(ie4||w3c){
y=0;
while(el.offsetParent!=null){
y+=el.offsetTop;
el=el.offsetParent;
}
y+=el.offsetTop;
return y;
}}

function scrollbox(){
if(ns4){
inner.top+=(godown)? pixelstep: -pixelstep;
if(godown){
if(inner.top>boxheight)inner.top=-elementheight;
}else{
if(inner.top<2-elementheight)inner.top=boxheight+2;
}}else{
inner.style.top=parseInt(inner.style.top)+((godown)? pixelstep: -pixelstep)+'px';
if(godown){
if(parseInt(inner.style.top)>boxheight)inner.style.top=-elementheight+'px';
}else{
if(parseInt(inner.style.top)<2-elementheight)inner.style.top=boxheight+2+'px';
}}}

window.onresize=function(){
if(ns4)setTimeout('history.go(0)', 400);
else{
outer.style.left=getPageLeft(ref)+'px';
outer.style.top=getPageTop(ref)+'px';
}}

window.onload=function(){
outer=(ns4)?document.layers['outer']:(ie4)?document.all['outer']:document.getElementById('outer');
inner=(ns4)?outer.document.layers['inner']:(ie4)?document.all['inner']:document.getElementById('inner');
ref=(ns4)?document.layers['ref']:(ie4)?document.all['ref']:document.getElementById('ref');
elementheight=getElHeight(inner);
if(ns4){
outer.moveTo(getPageLeft(ref),getPageTop(ref));
outer.clip.width=boxwidth;
outer.clip.height=boxheight;
inner.top=(godown)? -elementheight : boxheight-2;
inner.clip.width=boxwidth-4;
inner.clip.height=elementheight;
outer.visibility="show";
inner.visibility="show";
}else{
outer.style.left=getPageLeft(ref)+'px';
outer.style.top=getPageTop(ref)+'px';
inner.style.top=((godown)? -elementheight : boxheight)+'px';
inner.style.clip='rect(0px, '+(boxwidth-4)+'px, '+(elementheight)+'px, 0px)';
outer.style.visibility="visible";
}
setInterval('scrollbox()',speed);
}
</script>

</td>




That's it. I hope this helps

Any help?
Anthony

joh6nn
07-12-2002, 12:38 AM
can we see the code you have right now?