PDA

View Full Version : Pausing up-down message scroller Show 2 Messegs!? Simple



davidr
07-04-2005, 08:47 PM
Hi guys :
i really like this script and the only problem i have is that i like to change the number of messeges that shows at one , for example i like to show 3 messegs at once and not 1 by one as it in the original script .
link to the original script :
http://www.dynamicdrive.com/dynamicindex2/crosstick.htm
thanks for your help by adavnced . :)

bubba.daniel
07-04-2005, 09:34 PM
You are in the wrong location.

Be sure to use the proper format. thread (http://www.dynamicdrive.com/forums/showthread.php?t=6)

I didn't find any answers, best luck with dd.
:rolleyes:

jscheuer1
07-05-2005, 04:43 AM
Just use three messages per item in the code. If I remember correctly the message array looks something like this:


messages[0]="Some message"
messages[1]="Another message"
messages[2]="Yet another message"
If you want the first three to be one:


messages[0]="<p>Some message</p><p>Another message</p><p>Yet another message</p>"

davidr
07-05-2005, 08:09 AM
first thanks allot for your help , but thats not the good way to do it ( for me ofcourse ) cause i use database and i get my messeges from database and show them by loop inside the java script , i just looking for the parameter that actually changing the way of the showing messeges , so in this cause if the message 0 and message 1 and message 3 and message 4 comes from the databse the java scrip know that he has to show only the first 2 ( message[0] and message[1] ) and then message3 and 4 .
if you can help me out over here with this small change i will really approciate it .

jscheuer1
07-05-2005, 09:16 AM
What happened to messages[2]? Anyways, I don't see what the problem is. Concatenate the database supplied text(s) as you wish before you assign them a value of messages[x].

davidr
07-05-2005, 10:00 AM
What happened to messages[2]? Anyways, I don't see what the problem is. Concatenate the database supplied text(s) as you wish before you assign them a value of messages[x].
i just gave you a example jhone about messages it's seems that i forget about the message[2], my loop generates the number from 0 to the end of the database which can be 10 or 100 messages, now if you understand in asp codes you see that i take 1 line of the javascrip and loop the one line with content of the database so the loop starts from 0 and i just can Concatenate the messages cause i ahve no control on the messeges , there must be some parameter that decide how many messages to show per cycle , exactly like the high or the backgroud color .
thanks for your time .
Dave

Twey
07-05-2005, 10:49 AM
I don't know ASP, but I'm sure it's capable of concatenating three messages into one before assigning them into the array.

davidr
07-05-2005, 10:53 AM
I don't know ASP, but I'm sure it's capable of concatenating three messages into one before assigning them into the array.
Twey , belive me that this wonderful script must have this parameter , it make sens don't you think so ?

Twey
07-05-2005, 10:58 AM
Well... no, not really.
In ordinary circumstances the webmaster can just manually concatenate the messages, as suggested by John, and in more complex usage with a server-side script, the server-side script can be made to do it. There's not really any point.

jscheuer1
07-05-2005, 11:00 AM
Well, there is no parameter like that. The messages get parceled out for inclusion into two different html elements that chase each other in the scroller. The order would get jumbled up and include repetitions if we started assigning two of them to this multipart operation. If it is possible to run a few lines of javascript after the message array has been created and before the rest of the script executes, here are the lines to run:


var count=0, lb=ie? "<br>" : ""
for (m = 0; m < messages.length; m+=2){
if ((messages[m]!==undefined)&&(messages[m+1]!==undefined))
messages[count]=lb+'<p>'+messages[m]+'</p><p>'+messages[m+1]+'</p>'
else if (messages[m]!==undefined)
messages[count]=lb+'<p>'+messages[m]+'</p>'
count++
}

var messL=messages.length
for (i = count; i < messL; i++)
messages.pop()For example, in the demo version for this script that I used for testing, I put the above code right after where it says:
var ie=document.all
var dom=document.getElementByIdand it worked fine. I also had to adjust the 'scrollerheight' variable to make the scroller tall enough to accommodate the new height of each, now taller, message (increasing the scrollerwidth would work as well, in many cases). If I didn't do that, the messages would overlap. What this does is to rewrite the array putting two messages in the place of one for each entry and remove the excess entries.