Click here to Skip to main content
15,887,683 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Store one value from rows of data in a table Pin
jkirkerx26-Jun-15 8:46
professionaljkirkerx26-Jun-15 8:46 
GeneralRe: Store one value from rows of data in a table Pin
Rajesh_198029-Jun-15 6:31
Rajesh_198029-Jun-15 6:31 
GeneralRe: Store one value from rows of data in a table Pin
jkirkerx29-Jun-15 6:59
professionaljkirkerx29-Jun-15 6:59 
QuestionComparing two dates Pin
ap@238722-Jun-15 20:44
ap@238722-Jun-15 20:44 
AnswerRe: Comparing two dates Pin
User 418025410-Jul-15 12:01
User 418025410-Jul-15 12:01 
QuestionHow can I convert image to video in Javascript? Pin
Member 1161266222-Jun-15 20:33
Member 1161266222-Jun-15 20:33 
AnswerRe: How can I convert image to video in Javascript? Pin
jkirkerx26-Jun-15 8:55
professionaljkirkerx26-Jun-15 8:55 
QuestionShow more messages in a scroller Pin
Rajesh_198022-Jun-15 10:32
Rajesh_198022-Jun-15 10:32 
I am new to javascript and have to maintain an old application. I would like to know if there is a way I can make this scroller display more than one message at a time.
Thanks.
There is an array messages[] that holds all the messages.

JavaScript
var ie=document.all
var dom=document.getElementById

if (messages.length>2)
i=2
else
i=0

function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout("move1(tlayer)",scrollerdelay)
setTimeout("move2(document.main.document.second)",scrollerdelay)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",50)
}
else{
tlayer.top=parseInt(scrollerheight)
tlayer.document.write(messages[i])
tlayer.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}

function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",scrollerdelay)
setTimeout("move1(document.main.document.first)",scrollerdelay)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.top=parseInt(scrollerheight)
tlayer2.document.write(messages[i])
tlayer2.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}

function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
tdiv.style.top=0+"px"
setTimeout("move3(tdiv)",scrollerdelay)
setTimeout("move4(second2_obj)",scrollerdelay)
return
}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.top=parseInt(scrollerheight)
tdiv.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}

function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
tdiv2.style.top=0+"px"
setTimeout("move4(tdiv2)",scrollerdelay)
setTimeout("move3(first2_obj)",scrollerdelay)
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
setTimeout("move4(second2_obj)",50)
}
else{
tdiv2.style.top=parseInt(scrollerheight)
tdiv2.innerHTML=messages[i]
if (i==messages.length-1)
i=0
else
i++
}
}

function startscroll(){
if (ie||dom){
first2_obj=ie? first2 : document.getElementById("first2")
second2_obj=ie? second2 : document.getElementById("second2")
move3(first2_obj)
second2_obj.style.top=scrollerheight
second2_obj.style.visibility='visible'
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.top=parseInt(scrollerheight)+5
document.main.document.second.visibility='show'
}
}

window.onload=startscroll

</script>


<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight}; bgColor=&{scrollerbgcolor}; background={scrollerbackground}; visibility=hide>
<layer id="first" left=0 top=1 width=&{scrollerwidth};>
<script language="JavaScript1.2">
if (document.layers)
document.write(messages[0])
</script>
</layer>
<layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language="JavaScript1.2">
if (document.layers)
document.write(messages[dyndetermine=(messages.length==1)? 0 : 1])
</script>
</layer>
</ilayer>

<script language="JavaScript1.2">
if (ie||dom){
document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+' ;background-image:url('+scrollerbackground+')">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:1px;">')
document.write(messages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px;visibility:hidden">')
document.write(messages[dyndetermine=(messages.length==1)? 0 : 1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</div>')
}
</script>


modified 24-Jun-15 14:21pm.

QuestionHow can I convert audio channel from mono to stereo in Javascript? Pin
Member 1161266218-Jun-15 21:29
Member 1161266218-Jun-15 21:29 
Question99 Bottles of Beer Pin
Simewu15-Jun-15 16:29
professionalSimewu15-Jun-15 16:29 
GeneralRe: 99 Bottles of Beer Pin
PIEBALDconsult15-Jun-15 17:40
mvePIEBALDconsult15-Jun-15 17:40 
GeneralRe: 99 Bottles of Beer Pin
Simewu16-Jun-15 17:36
professionalSimewu16-Jun-15 17:36 
Answer99 Bottles of Beer Pin
Simewu16-Jun-15 17:42
professionalSimewu16-Jun-15 17:42 
GeneralRe: 99 Bottles of Beer Pin
PIEBALDconsult16-Jun-15 18:09
mvePIEBALDconsult16-Jun-15 18:09 
GeneralRe: 99 Bottles of Beer Pin
Simewu16-Jun-15 19:17
professionalSimewu16-Jun-15 19:17 
QuestionHow to bind image in jquery Pin
balajiparamkusam15-Jun-15 5:01
balajiparamkusam15-Jun-15 5:01 
QuestionThe 'contract' attribute is invalid. The value '#####.Services.SessionPool' is invalid according to its datatype 'serviceContractType' - The Enumeration constraint failed. Pin
Bigprey15-Jun-15 2:05
Bigprey15-Jun-15 2:05 
GeneralRe: The 'contract' attribute is invalid. The value '#####.Services.SessionPool' is invalid according to its datatype 'serviceContractType' - The Enumeration constraint failed. Pin
Kornfeld Eliyahu Peter15-Jun-15 7:42
professionalKornfeld Eliyahu Peter15-Jun-15 7:42 
QuestionApplications that leverage Microsoft AJAX.NET (Atlas) can be vulnerable to JavaScript hijacking, Pin
Stephen Holdorf11-Jun-15 7:28
Stephen Holdorf11-Jun-15 7:28 
AnswerRe: Applications that leverage Microsoft AJAX.NET (Atlas) can be vulnerable to JavaScript hijacking, Pin
Afzaal Ahmad Zeeshan12-Jun-15 11:06
professionalAfzaal Ahmad Zeeshan12-Jun-15 11:06 
Questionwhere is require file? Pin
Ferd Really11-Jun-15 5:30
Ferd Really11-Jun-15 5:30 
AnswerRe: where is require file? Pin
R. Giskard Reventlov11-Jun-15 6:04
R. Giskard Reventlov11-Jun-15 6:04 
GeneralRe: where is require file? Pin
Ferd Really11-Jun-15 6:55
Ferd Really11-Jun-15 6:55 
GeneralRe: where is require file? Pin
Ferd Really11-Jun-15 9:33
Ferd Really11-Jun-15 9:33 
Questionwebkitfullscreenchange, mozfullscreenchange, fullscreenchange is not working for ipad Pin
joshi akhilesh10-Jun-15 1:30
professionaljoshi akhilesh10-Jun-15 1:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.