Link to home
Start Free TrialLog in
Avatar of yenmei
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.all)? scrollerspeed : Math.max(1, scrollerspeed-1) //slow speed down by 1 for NS
                        var copyspeed=scrollerspeed
                        var iedom=document.all||document.getElementById
                        var actualheight=''
                        var cross_scroller, ns_scroller
                        var pausespeed=(pauseit==0)? copyspeed: 0

                        function populate(){
                        if (iedom){
                        cross_scroller=document.getElementById? document.getElementById("iescroller") : document.all.iescroller
                        cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
                        cross_scroller.innerHTML=scrollercontent
                        actualheight=cross_scroller.offsetHeight
                        }
                        else if (document.layers){
                        ns_scroller=document.ns_scroller.document.ns_scroller2
                        ns_scroller.top=parseInt(scrollerheight)+8
                        ns_scroller.document.write(scrollercontent)
                        ns_scroller.document.close()
                        actualheight=ns_scroller.document.height
                        }
                        lefttime=setInterval("scrollscroller()",20)
                        }
                        // window.onload=populate

                        function scrollscroller(){

                        if (iedom){
                        if (parseInt(cross_scroller.style.top)>(actualheight*(-1)+8))
                        cross_scroller.style.top=parseInt(cross_scroller.style.top)-copyspeed+"px"
                        else
                        cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
                        }
                        else if (document.layers){
                        if (ns_scroller.top>(actualheight*(-1)+8))
                        ns_scroller.top-=copyspeed
                        else
                        ns_scroller.top=parseInt(scrollerheight)+8
                        }
                        }

                        if (iedom||document.layers){
                        with (document){
                        if (iedom){
                        write('<div style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=scrollerspeed">')
                        write('<div id="iescroller" style="position:absolute;left:0px;top:0px;width: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=pausespeed" onMouseout="copyspeed=scrollerspeed"></layer>')
                        write('</ilayer>')
                        }
                        }
                        }
                        </script>
ASKER CERTIFIED SOLUTION
Avatar of stu_pb
stu_pb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of justinbillig
justinbillig

though i wouldnt use document.all.hiddenAbstracts.value becuase that is I only

you can use

document.formname.hiddenAbstracts.value

or document.forms[ 'formname' ].elements[ 'hiddenAbstracts' ].value
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
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
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