Log in

View Full Version : Help with Latest News..



OhLiam
17-04-2008, 10:20 AM
See on Habbo they have Latest news, which changes from different ones, how would I go about creating something like this?

Which I could edit manually not automated.

If anyone could help/ create this for me, it would be very much appreciated =]

iUnknown
17-04-2008, 04:51 PM
Hope this helps:

Put this in the <head> </head> area in the code of your page. Go through it, you edit the text that appears and the image in it.


<script type="text/javascript">



var preloaded = new Array();

function preloadImages() {

for (var i = 0; i < arguments.length; i++){

preloaded[i] = document.createElement('img');

preloaded[i].setAttribute('src',arguments[i]);

};

};

preloadImages(

'image1.gif',

'image2.gif',

'image3.gif'



);



var links = new Array(

'http://yoursite.com/resultofclickimage1.html',

'http://yoursite.com/resultofclickimage2.html',

'http://yoursite.com/resultofclickimage3.html'



);



var text = new Array(

'<center>Text for Image 1</center>',

'<center>Text for Image 2</center>',

'<center>Text for Image 3</center>'





);



var curOffset = 1;



window.onload=function() {

document.getElementById('randLink').href = links[0];

document.getElementById('randImage').src = preloaded[0].src;

document.getElementById('randText').innerHTML = text[0];

setInterval(

function() {

document.getElementById('randLink').href = links[curOffset];

document.getElementById('randImage').src = preloaded[curOffset].src;

document.getElementById('randText').innerHTML = text[curOffset];

curOffset = (curOffset >= preloaded.length-1) ? 0 : curOffset + 1;

}, 10000);

};

</script>

Then this where you want the image and text to appear:

You have to go through this as well and edit everything you want to edit.


<div id="ts_image" style="padding-top: 4px;" align="center">

<span class="style9"><a id="randLink" href="http://yoursite.com/resultofclickingimage1.html" target="iframename"><img src="image1.gif" name="randImage" width="150" height="150" border="0" id="randImage"></a></span></div>

<div align="left" class="font" id="ts_text" style="padding-top: 4px;">

<div id="randText">

<div align="center">First Image Text</div>

</div>

</div>

I hope that is helpful for you. The easiest way to edit the fonts is through CSS... you could put something like this in the <head></head> before the code I put earlier for you to put into the header:



<style>

.font {

font-family: Verdana;

font-size: 12px;

}

</style>


That code will automatically set the font for the text that appears (I've coded it in, but if you don't add that CSS then it'll just use the computer's default font.

If you need anymore help, let me know :)

Want to hide these adverts? Register an account for free!