Welcome Guest [Log In] [Register]
We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
A somewhat weird code I need help with
Topic Started: Jul 18 2009, 08:53 PM (349 Views)
k arthur90-ZNS
Member
 *  
> Here's the deal. On our forums, we have a Header with scrolling headlines.
> Each headline must currently be inputed manually using the following template
Code:
 

<!--dd-mm--><p><a href="http://zx.invisionfree.com/FORUM/index.php?showtopic=4626">HEADLINES</a></p>


> I noticed that there's a Javascript function called "array" or something like that, that could allow me to, using javascript, enter new headlines, as well remove old ones, by just inputing the topic number and the headline I'd like to be shown. The main problem is, I have no idea how to set a data array, that allows me to simply enter new info by only adding new headlines.
> Something along the lines of:
Quote:
 

For each line specifiying the vars HLINE and HTOPIC, "document.write" ('<p><a href=http://zx.invisionfree.com/FORUM/index.php?showtopic'+HTOPIC+'>'+HLINE+'</p></a>')

> Could someone please shed some help here?




> EDIT: So far I only managed to get this
Code:
 

<script type="text/Javascript">

heads[n++]=['headline topic','headline text']
heads[n++]=['headline topic','headline text']
heads[n++]=['headline topic','headline text']

</script>


> Which is a small start only :$
Edited by k arthur90-ZNS, Jul 18 2009, 09:16 PM.
Offline Profile Quote Post Goto Top
 
Reid-ZNS
Member Avatar
C'est un piège!
 *   *   *   *   *   *  
Code:
 
<script type='text/javascript'>
// <![CDATA[
var heads = [], n = 0;
heads[n++] = ['headline topic','headline text'];
// and so on
var l = heads.length;
while (l--) {
document.write("<p><a href='http://zX.invisionfree.com/forum/index.php?showtopic=" + heads[l][0] + "'>" + heads[l][1] + "</a></p>");
}
// ]]>
</script>
Try that.
Offline Profile Quote Post Goto Top
 
k arthur90-ZNS
Member
 *  
> ;) You saved my life ^_^
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · zIFBoards - Skinning & Code Support · Next Topic »
Add Reply