yenmei
asked on
Scrolling Text Stored in a SQL Database
Hello,
I am trying to create an application of a home page with a small window that has scrolling text of publications abstracts stored in a SQL database. Now I have to hand code every abstracts into the javascript code, I am just wondering how can I pull these abstracts from a SQL database?
<script language="javascript">
var scrollerwidth="170"
var scrollerheight="450"
var scrollerspeed="1";
var scrollercontent="I have to hand code the contents here "
var pauseit=1
scrollerspeed=(document.al l)? scrollerspeed : Math.max(1, scrollerspeed-1) //slow speed down by 1 for NS
var copyspeed=scrollerspeed
var iedom=document.all||docume nt.getElem entById
var actualheight=''
var cross_scroller, ns_scroller
var pausespeed=(pauseit==0)? copyspeed: 0
function populate(){
if (iedom){
cross_scroller=document.ge tElementBy Id? document.getElementById("i escroller" ) : document.all.iescroller
cross_scroller.style.top=p arseInt(sc rollerheig ht)+8+"px"
cross_scroller.innerHTML=s crollercon tent
actualheight=cross_scrolle r.offsetHe ight
}
else if (document.layers){
ns_scroller=document.ns_sc roller.doc ument.ns_s croller2
ns_scroller.top=parseInt(s crollerhei ght)+8
ns_scroller.document.write (scrollerc ontent)
ns_scroller.document.close ()
actualheight=ns_scroller.d ocument.he ight
}
lefttime=setInterval("scro llscroller ()",20)
}
// window.onload=populate
function scrollscroller(){
if (iedom){
if (parseInt(cross_scroller.s tyle.top)> (actualhei ght*(-1)+8 ))
cross_scroller.style.top=p arseInt(cr oss_scroll er.style.t op)-copysp eed+"px"
else
cross_scroller.style.top=p arseInt(sc rollerheig ht)+8+"px"
}
else if (document.layers){
if (ns_scroller.top>(actualhe ight*(-1)+ 8))
ns_scroller.top-=copyspeed
else
ns_scroller.top=parseInt(s crollerhei ght)+8
}
}
if (iedom||document.layers){
with (document){
if (iedom){
write('<div style="position:relative;w idth:'+scr ollerwidth +';height: '+scroller height+';o verflow:hi dden" onMouseover="copyspeed=pau sespeed" onMouseout="copyspeed=scro llerspeed" >')
write('<div id="iescroller" style="position:absolute;l eft:0px;to p:0px;widt h:100%;">' )
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+scrollerwidth+' height='+scrollerheight+' name="ns_scroller">')
write('<layer name="ns_scroller2" width='+scrollerwidth+' height='+scrollerheight+' left=0 top=0 onMouseover="copyspeed=pau sespeed" onMouseout="copyspeed=scro llerspeed" ></layer>' )
write('</ilayer>')
}
}
}
</script>
I am trying to create an application of a home page with a small window that has scrolling text of publications abstracts stored in a SQL database. Now I have to hand code every abstracts into the javascript code, I am just wondering how can I pull these abstracts from a SQL database?
<script language="javascript">
var scrollerwidth="170"
var scrollerheight="450"
var scrollerspeed="1";
var scrollercontent="I have to hand code the contents here "
var pauseit=1
scrollerspeed=(document.al
var copyspeed=scrollerspeed
var iedom=document.all||docume
var actualheight=''
var cross_scroller, ns_scroller
var pausespeed=(pauseit==0)? copyspeed: 0
function populate(){
if (iedom){
cross_scroller=document.ge
cross_scroller.style.top=p
cross_scroller.innerHTML=s
actualheight=cross_scrolle
}
else if (document.layers){
ns_scroller=document.ns_sc
ns_scroller.top=parseInt(s
ns_scroller.document.write
ns_scroller.document.close
actualheight=ns_scroller.d
}
lefttime=setInterval("scro
}
// window.onload=populate
function scrollscroller(){
if (iedom){
if (parseInt(cross_scroller.s
cross_scroller.style.top=p
else
cross_scroller.style.top=p
}
else if (document.layers){
if (ns_scroller.top>(actualhe
ns_scroller.top-=copyspeed
else
ns_scroller.top=parseInt(s
}
}
if (iedom||document.layers){
with (document){
if (iedom){
write('<div style="position:relative;w
write('<div id="iescroller" style="position:absolute;l
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+scrollerwidth+' height='+scrollerheight+' name="ns_scroller">')
write('<layer name="ns_scroller2" width='+scrollerwidth+' height='+scrollerheight+' left=0 top=0 onMouseover="copyspeed=pau
write('</ilayer>')
}
}
}
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
err that was riddidled with spelling errors,
i was trying to say that document.all is IE Only, so use either of those examples in stu's example
i was trying to say that document.all is IE Only, so use either of those examples in stu's example
If u want to get the data from the server using an html file you need to use remote scripting concept. Please see the below example to get an understanding of remote scripting
http://www.ashleyit.com/rs/jsrs/test.htm. The code is used to return a simple string and you can change the logic to get the string from the database
http://www.ashleyit.com/rs/jsrs/test.htm. The code is used to return a simple string and you can change the logic to get the string from the database
eh i believe that remote scripting is a little over the top for what he needs. You can just get it from your ASP page and give it to the html
you can use
document.formname.hiddenAb
or document.forms[ 'formname' ].elements[ 'hiddenAbstracts' ].value