PDA

View Full Version : IFRAME scroller



Hepple
01-18-2007, 08:09 PM
1) Script Title: IFRAME scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm

3) Website: http://www.callus.cc/v2

4) Describe problem: It works perfectly in Firefox but not IE. It shows up my content, but does not scroll. I do receive an error in IE in the bottom left hand corner where it says "Done". The error is as follows;

Error: 'dataobj.style' is null or not an object

I have a good idea that the problem lies in the java script in my linked file. Here's the source code;


<?php

function gigs()
{
include_once("mysql.php");
include_once("bbcode.php");
$db2 = new db;
$db2->connect();

$sql = "SELECT * FROM mygigs_gigs WHERE Active='1' ORDER BY Post_Date ASC";
$return = $db2->query($sql);

while ( $row = mysql_fetch_array($return) )
{?>

<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
font-size: 11px;
}
body {
background-color: #0B0B0B;
margin-left: 5px;
}
.style1 {font-size: 11px}
.style2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #990000;
}
.style3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #FFFFFF;
}
-->
</style>

<div id="datacontainer" style="position:absolute" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="5" colspan="2"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td width="816" valign="bottom"><span class="style2"><strong><?php echo @stripslashes($row[gigs_Title]); ?></strong></span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="style3"><?php
$Text = @stripslashes($row[gigs_Body]);
$mytext = BBcode($Text);
echo $mytext;
?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
</tr>
</table>
<?php }

} // end of function gigs
?>
</div>

<script type="text/javascript">

/***********************************************
* IFRAME Scroller script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Specify speed of scroll. Larger=faster (ie: 5)
var scrollspeed=cache=1

//Specify intial delay before scroller starts scrolling (in miliseconds):
var initialdelay=5000

function initializeScroller(){
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top="5px"
setTimeout("getdataheight()", initialdelay)
}

function getdataheight(){
thelength=dataobj.offsetHeight
if (thelength==0)
setTimeout("getdataheight()",10)
else
scrollDiv()
}

function scrollDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top="70px"
setTimeout("scrollDiv()",100)
}

if (window.addEventListener)
window.addEventListener("load", initializeScroller, false)
else if (window.attachEvent)
window.attachEvent("onload", initializeScroller)
else
window.onload=initializeScroller
</script>

ddadmin
01-19-2007, 04:37 AM
There is a lot of invalid tags in your external html page. For example, the tag:


<div id="datacontainer" style="position:absolute" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">

is repeated twice. That, plus a slew of unclosed and invalid tag containerships. Try reverting back to the original external.htm (http://www.dynamicdrive.com/dynamicindex2/external.htm) page, then gradually change it to your own, making sure each step of the way the HTML is valid.

Hepple
01-21-2007, 12:49 AM
Thankyou, I did what you suggested and I got the same result. I have been playing around with the code and have found that if I remove the database connection code from the start, I do get errors because its looking for the code, but the scroll works in IE and Firefox.

This code is as follows;

<?php

function gigs()
{
include_once("mysql.php");
include_once("bbcode.php");
$db2 = new db;
$db2->connect();

$sql = "SELECT * FROM mygigs_gigs WHERE Active='1' ORDER BY Post_Date ASC";
$return = $db2->query($sql);

while ( $row = mysql_fetch_array($return) )
{?>

I do need this code for my dynamic content to work, so it receives data from my mysql database. But the scroll will not work in IE with this code.

Any advice?

Hepple
01-26-2007, 12:06 AM
Just thought Id bump this to see if anyone has a solution to the obtrusive code.

Thanks