Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting a tab

Status
Not open for further replies.

SonicBoomBand

Technical User
Jun 4, 2004
42
GB
I have this bit of VB Script that writes the results of a recordset to my asp page. However nothing happens where the 'vbtabs' are located. Is it possible to do this and if so can somebody amend for me.

rs.open "SELECT ID, Year, Venue, Course1, Course2, Winner FROM tblTrophyWinners",objConn

do until rs.eof
response.write ("<font size=2><b>" & rs("ID") & vbtab & rs("Year") & " " & rs("Venue") & "</b></font><br>")
response.write ("<font size=2>" & vbtab & rs("course1") & "</font><br>")
response.write ("<font size=2>" & rs("course2") & "</font><br>")
response.write ("<font size=2>Winner:" & " " & "<b>" & rs("Winner") & "</b></font><br>")
response.write ("<hr>")
rs.movenext
loop


Many Thanks

Andrew Chamberlain
National Grid
 
Since this appears to be tabular data, why not use a table? You might also consider using CSS to style your output to remove the need for deprecated <font> tags

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
This data is being output to a scroller box, which I believe can't hold tables.

Andrew Chamberlain
National Grid
 
That depends on what you mean by 'scroller box' - many are implemented in a <div> which can hold a table. Perhaps you can be a bit more explicit, maybe show us what the scroller is?

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Also, to answer your initial question: the tabs are still there. When you output a series of tabs, spaces, etc (whitespace) to a browser, it compacts it all down to a single space. If you view the source in your browser you will see the tabs in the source HTML for the page.

To replace this with CSS (I'll let you guys continue the table conversation without me), you could do something like this:
Code:
    do until rs.eof
        response.write "<div class=""scrollItem"">"
        response.write "<strong>" & rs("ID") & " " & rs("Year") & " " & rs("Venue") & "</strong><br/>"
        response.write "<span class=""indent"">" & rs("course1") & "</span><br/>"
        response.write rs("course2") & "<br/>"
        response.write "Winner:" & " " & "<strong>" & rs("Winner") & "</strong><br/>"
        response.write "</div><hr>"
        rs.movenext    
    loop

And then define the styles in the head section like so:
Code:
.scrollItem{
   font-size: 8pt;
}
.indent{
   margin-left: 1em;
}

If you wanted you could even get rid of the <hr/> tag and just add a border-bottom: 1px solid black; to the css defintion for the scrollItem.

In any case, just wanted to provide an example. theer are numerous other ways this could be done and if you decide to go this route you will probably find one more to your liking once you start playing aroudn with CSS a bit more :)

-T

 
Don't know if this will explain what kind of scroller box I am using, but we will see. '<% getWinners %>' is obviously calling my original response.write post above.

<script language="JavaScript1.2">

var scrollerwidth=171
var scrollerheight=500
var speed=2
var scrollercontents='<% getWinners() %>'

if (document.all)
document.write('<marquee direction="up" scrollAmount='+speed+' style="background:FFFFFF; width:'+scrollerwidth+';height:'+scrollerheight+'">'+scrollercontents+'</marquee>')

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializescroller()
}
}

function intializescroller(){
document.vscroller01.document.vscroller02.document.write(scrollercontents)
document.vscroller01.document.vscroller02.document.close()
thelength=document.vscroller01.document.vscroller02.document.height
scrollit()
}

function scrollit(){
if (document.vscroller01.document.vscroller02.top>=thelength*(-1)){
document.vscroller01.document.vscroller02.top-=speed
setTimeout("scrollit()",50)
}
else{
document.vscroller01.document.vscroller02.top=scrollerheight
scrollit()
}
}

window.onload=regenerate2
</script>


Andrew Chamberlain
National Grid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top