Hi there,
I've got a simple page that uses the newsticker plug-in (http://www.texotela.co.uk/code/jquery/newsticker/), as follows:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
.newsticker {
list-style-type: none;
list-style-position:outside;
padding:0 0 0 0;
margin:0 0 0 0;
font-family:"Lucida Grande", Geneva, Arial, Helvetica, sans-serif;
font-size:12px;
color:#000;
}
</style>
<script type="text/_javascript_" src=""></script>
<script type="text/_javascript_" src=""></script>
<script type="text/_javascript_">
$(document).ready(
function()
{
$("#news").newsTicker();
}
);

function showdiv() {
document.getElementById('news').style.display='block';
}

function hidediv() {
document.getElementById('news').style.display='none';
}

function replacecontents() {
info='<li>Replaced 1</li><li>Replaced 2</li><li>Replaced 3</li><li>Replaced 4</li>';
document.getElementById('news').innerHTML=info;
}
</script>
</head>
<body>
<ul id="news">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
<input type="button" value="Show" />
<input type="button" value="Hide" />
<input type="button" value="Replace" />
</body>
</html>


The resulting page looks like this:-

Attachment: Picture 1.png
Description: application/applefile

PNG image

The ticker rotates through 'Item 1', 'Item 2', 'Item 3' and 'Item 4' 



The problem is clicking the 'Replace' button runs the replacecontents function which updates the div contents with a list, thus breaking the ticker effect as below:-

Attachment: Picture 2.png
Description: application/applefile

PNG image


Having had similar experiences with other plug-ins I'm thinking the plug-in code needs to somehow be re-initiated.
My question is, is there a way to dynamically run or re-run $(document).ready or similar?
Or am I missing something/is there a 'proper' way to do what I'm after?

Many thanks in advance.

Reply via email to