Advertisement
Java_Volume1 Internet/ Browsers/ HTML #99475

Creating an iframe scroller (similar to the one used by PSC).

This article shows creating a IFRAME scroller similar to the one used by PSC on the left side of page.

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
<p><b><font size="4">Creating an iframe scroller (similar to the one used by
PSC).</font></b></p>
<p><font size="3">Ok, so this is based mainly on a script by <a href="http://www.dynamicdrive.com">Dynamic
Drive</a>, but I think many people would be interested in it, since it&nbsp;creates
a scroller very similar to the one you see on the left side of
Planet-Source-Code. It's an iframe scroller where the contents is contained
inside a external document.</font></p>
<p>The script comes in two parts:</p>
<p><b>Index.htm:</b></p>
<p><font face="Courier" size="2">&lt;!--This script by Dynamic Drive
(http://www.dynamicdrive.com)--&gt;<br>
&lt;!--Modified by Mike Thompson--&gt;<br>
&lt;iframe id="datamain" src="external.htm" width=150 height=150 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=1 scrolling=no>&lt;/iframe></font></p>
<p><b>External.htm</b></p>
<p><font face="Courier" size="2">&lt;html><br>
&lt;body><br>
<br>
&lt;div id="datacontainer" style="position:absolute;left:0;top:10;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache"><br>
<br>
&lt;!-- ADD YOUR SCROLLER COMMENT INSIDE HERE---------------------><br>
<br>
YOUR CONTENT HERE<br>
<br>
&lt;!-- END SCROLLER CONTENT----------------------------------------><br>
<br>
&lt;div><br>
<br>
&lt;script language="JavaScript1.2"><br>
<br>
//&lt;iframe> script by Dynamicdrive.com<br>
<br>
//Specify speed of scroll. Larger=faster (ie: 5)<br>
var scrollspeed=cache=2<br>
<br>
function initialize(){<br>
marqueeheight=document.all? parent.document.all.datamain.height : parent.document.getElementById("datamain").getAttribute("height")<br>
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")<br>
dataobj.style.top=5<br>
thelength=dataobj.offsetHeight<br>
setTimeout("scrolltest()",200)<br>
}<br>
<br>
function scrolltest(){<br>
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed<br>
if (parseInt(dataobj.style.top)&lt;thelength*(-1))<br>
dataobj.style.top=5<br>
setTimeout("scrolltest()",50)<br>
}<br>
<br>
window.onload=initialize<br>
<br>
&lt;/script><br>
<br>
&lt;/body><br>
&lt;/html></font></p>
<p><font size="3">The entire script is also attached as a zip file, so you can
begin using it right away on your site.</font></p>
Komentar Asli (3)
Dipulihkan dari Wayback Machine