PDA

View Full Version : Any Java Programmers Willing to Help?


yunghungwell
09-12-2006, 12:01 PM
I was building a web page and wanted to do something like the scrolling schedule on this web page.

http://www.central-decatur.k12.ia.us/

Since the inception my idea I came to a few realizations.

1. The scrolling text on that web site is run by Java.

2. A person can get a program to run scrolling text on the internet, but you have to pay for it if you don't want the ugly "Unregistered Version" box on the scroll.

3. It might be nice to learn some Java for "fun" and future use/webpages/resume building.

4. It is going to take a while to "learn" Java and I would like to have some success here in the beginning before I get POed and say screw "learning" Java.


Anyone out there that has done this before and can give me a little advice?

StcChief
09-12-2006, 12:13 PM
Java Server Page? or Java? There's a difference.

yunghungwell
09-12-2006, 12:36 PM
Just regular Java. (I think) I started here.

http://computer.howstuffworks.com/program.htm/printable

Simplex3
09-12-2006, 11:11 PM
Java is for pu**ies. Just do it using Javascript. There are no fewer than a thousand examples on the web, I found this one in 2 minutes.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
/*<![CDATA [*/
function getData(){
document.getElementById("scroll").innerHTML=getFile("text.txt");
}
function getFile(fileName){
oxmlhttp = null;
try{
oxmlhttp = new XMLHttpRequest();
oxmlhttp.overrideMimeType("text/xml");
}
catch(e){
try{
oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
return null;
}
}
if(!oxmlhttp) return null;
try{
oxmlhttp.open("GET",fileName,false);
oxmlhttp.send(null);
}
catch(e){
return null;
}
return oxmlhttp.responseText;
}
/*]]>*/
</script>
</head>

<body>
<marquee direction="down" id="scroll">Dummy text</marquee>
<script type="text/javascript">getData();</script>

</body>
</html>

Simplex3
09-12-2006, 11:16 PM
Here's another one that's nice:


<html>

<head>
<script language="javascript">

info=new Array()
info[0]='<b>First Message</b><BR>blahblahblah'
info[1]='<b>Second Message</b><BR>blahblahblah.<BR>'
info[2]='<b>Third Message</b><BR>blahblahblahblah'
info[3]='<div style="width:100%;height:100%;padding:5px;border:1px solid blue;background-image:url(image000.jpg);color:white">This is an example using a div with CSS attributes attatched</div>'

pausing=0 // 0 = continuous, 1 = pause
pause=2000 // paused time

step=1
run_rate=50
next_message=0

function init_scroller_v1(){
el_cont=document.getElementById("cont_div")
el_one=document.getElementById("div_one")
el_two=document.getElementById("div_two")

el_one.innerHTML=""
el_two.innerHTML=info[0]

if(el_one.offsetHeight<parseInt(el_cont.style.height)){el_one.style.height=parseInt(el_cont.style.height)}
if(el_two.offsetHeight<parseInt(el_cont.style.height)){el_two.style.height=parseInt(el_cont.style.height)}

el_one.style.top=0
el_two.style.top=parseInt(el_cont.style.height)//el_one.offsetHeight+parseInt(el_cont.style.height)

scrollme()

}

function scrollme(){
chk=0
if(el_one.offsetHeight<parseInt(el_cont.style.height)){el_one.style.height=parseInt(el_cont.style.height)}
if(el_two.offsetHeight<parseInt(el_cont.style.height)){el_two.style.height=parseInt(el_cont.style.height)}

el_one_pos=parseInt(el_one.style.top)
el_two_pos=parseInt(el_two.style.top)

el_one_pos-=step
el_one.style.top=el_one_pos

el_two_pos-=step
el_two.style.top=el_two_pos

if(el_one_pos< - el_one.offsetHeight){

next_message++
if(next_message>info.length-1){next_message=0}
el_one.innerHTML=info[next_message]

if(el_two.offsetHeight<parseInt(el_cont.style.height)){el_one.style.top=parseInt(el_cont.style.height)}
else{el_one.style.top=parseInt(el_two.style.top)+el_two.offsetHeight}

chk=1
}

if(el_two_pos< - el_two.offsetHeight){

next_message++
if(next_message>info.length-1){next_message=0}
el_two.innerHTML=info[next_message]

if(el_one.offsetHeight<parseInt(el_cont.style.height)){el_two.style.top=parseInt(el_cont.style.height)}
else{el_two.style.top=parseInt(el_one.style.top)+el_one.offsetHeight}

chk=1
}

timer=setTimeout("scrollme()",run_rate)

if(pausing==1&&chk==1){
clearTimeout(timer)
chk=0
setTimeout("scrollme()",pause)
}

}

// add onload="init_scroller_v1()" to the opening BODY tag

// -->
</script>
</head>
<body onload="init_scroller_v1()">
<div id="cont_div" style="position:absolute; left:215px; top:80px; width:250px; height:120px; border:1px dotted #8e8462;clip:rect(0,250,120,0);background-color:#c9bda9;color:#000000">
<div id="div_one" style="position:absolute; left:0px; top:0px;z-index:1"></div>
<div id="div_two" style="position:absolute; left:0px; top:0px;z-index:1"></div>
</div>
</body>
</html>

Halfcan
09-13-2006, 12:31 AM
I thought this thread was about fixing a coffee machine-my bad.