PDA

View Full Version : Text rotator


BAVARAC
12-04-2007, 05:53 PM
Hi,

my i can put text rotator in the box? I create box and i type text and this text displey ... when i paste java script for text rotating my box be white. How can i put script in the box?

Sorry for my english, thanks

------

Napravio sam box, i on se pokazuje na indexu ... kada u box napisem neki text i on se pokazuje u boxu na indexu ali kada kopiram neku scriptu kojom bi se text mijenjao pri refreshu to se ne pokazuje ... imate li neku prijedlog? ili neku drugu skriptu za promjenu teksta ... npr VIC DANA itd

Micha
12-05-2007, 09:20 AM
Can you share script that you used in your box?

Quick not on JavaScript inclusion:

If an empty tag is given VTE will print it as self closing tag thus your <script src=""></script> becomes <script src="" />. This can mess up browser rendering and behavior, so use this instead <script src=""> </script> (notice the space).

Also if you want to use other script, check some of these sites, you may find something useful:

http://www.dynamicdrive.com/dynamicindex2/

http://www.ajaxrain.com/tagcloud.php

http://miniajax.com/

BAVARAC
12-05-2007, 10:32 AM
This is code for script:

<script language="JavaScript">
function rotateEvery(sec)
{
var Quotation=new Array()

// QUOTATIONS
Quotation[0] = 'First quotation';
Quotation[1] = 'Second quotation';
Quotation[2] = 'Third quotation';
Quotation[3] = 'Fourth quotation';
Quotation[4] = 'Fiveth quotation';
Quotation[5] = 'Sixth quotation';
Quotation[6] = 'You can add <b>as many</b> quotations <b>as you like</b>';

var which = Math.round(Math.random()*(Quotation.length - 1));
document.getElementById('textrotator').innerHTML = Quotation[which];

setTimeout('rotateEvery('+sec+')', sec*1000);
}
</script>
</head>
<body onload="rotateEvery(1)">
<div id="textrotator"><!--Quotations will be displayed here--></div>


how can i add to the box?

Micha
12-05-2007, 11:06 AM
Here you go:

<vte:template>
<script language="JavaScript">
function rotateEvery(sec)
{
var Quotation=new Array()

// QUOTATIONS
Quotation[0] = 'First quotation';
Quotation[1] = 'Second quotation';
Quotation[2] = 'Third quotation';
Quotation[3] = 'Fourth quotation';
Quotation[4] = 'Fiveth quotation';
Quotation[5] = 'Sixth quotation';
Quotation[6] = 'You can add <b>as many</b> quotations <b>as you like</b>';

var which = Math.round(Math.random()*(Quotation.length - 1));
document.getElementById('textrotator').innerHTML = Quotation[which];

setTimeout('rotateEvery('+sec+')', sec*1000);
}
Event.observe(window, 'load', function() {
rotateEvery(1);
});
</script>
<div id="textrotator"> </div>
</vte:template>

Save this as custom_ticker.tpl for example, and include it where you want it to appear.

BAVARAC
12-05-2007, 11:21 AM
hmm

thanks, but please told me how i can insert that custom.tpl in the box?

I create my box ... and i must type this?:

<vte:load module="custom_ticker" template="templates/xhtml/plugin/generator/custom_ticker.tpl" />

?

Micha
12-05-2007, 12:13 PM
http://www.vivvo.net/doc/

BAVARAC
12-05-2007, 12:46 PM
Thanks, i create this :) Thanks!

Only i need to find script for randomize text for evry refresh page ... any have?