Div Layout

new BookmarkLockedFalling
metro
Full Member
***

metro Avatar

Posts: 207

Post by metro on Apr 24, 2015 23:29:44 GMT -5

After 4 years of doing nothing with Runbasic yesterday I dusted it off and started coding
brain is a bit rusty so I'm here for some help
I want to solve two things...
1) why wont the div "footer" sit below the table div (it scrolls with the table)
2) is there a way to create a link for the first field in the table (the "code" field) or do I need to use a different approach to insert into the table
ultimately this will be a Sqlite Db and The link will be used to search

thanks in advance....
Ps its slow
' -------------------------------------
' HTML <table> data to CSC file
' converts all tables in the html
' change: webPage$ and fileName$ belohtml " w
' Credit to Dan Kokenge
' --------------------------------------
sep$=Chr$(34)+Chr$(44)+Chr$(34)

' change this to your web page
webPage$ = "http://www.asx.com.au/asx/markets/optionPrices.do?by=underlyingCode&underlyingCode=FMG&expiryDate=&optionType="

' small table
' webPage$ = "http://www.asx.com.au/asx/markets/optionPrices.do?by=asxCodes&asxCodes=XJOVW7"

' change this to your output csv file name
fileName$ = "myCsv"
htmlData$ = httpget$(webPage$)
lowData$ = lower$(htmlData$)

open DefaultDir$ + "/public/";fileName$;".csv" for output as #f

Call setCSS

div Container 'Main
html "<head>"
html "<h1> OPTIONS TRACKING</h1>"
html "</head>"
html "<div align='right'>"


div navigation
print "Menu"
link #testIt, "Enter New trade", [linkAction]
print
link #CurPos, "Current Pos", [linkAction]
print
link #HistData , "Historical", [linkAction]
print
link #DldIndex, "Download Index", [linkAction]
print
link #Bacitup, "Backup", [linkAction]
end div


[nxtTbl]
div mytable

[tbl2]
html "<TABLE border=1>"

tblBeg = instr(lowData,ドル"<table",tblEnd)
if tblBeg = 0 then goto [endTbl]
tblEnd = instr(lowData,ドル"</table>",tblBeg)
tblData$ = mid$(htmlData,ドルtblBeg,(tblEnd - tblBeg) + 8)
lineBeg = 0
lineEnd = instr(tblData,ドル"</tr>",lineBeg)

while lineEnd > 0
lineData$ = mid$(tblData,ドルlineBeg - 1,(lineEnd - lineBeg) + 1)
lineData$ = strip$(lineData$)
lineData$ = strRep$(lineData,ドル"</td>",""",""")
lineData$ = strRep$(lineData,ドル"</th>",""",""")
lineData$ = tags$(lineData,ドル"")
lineData$ = strRep$(lineData,ドル" "," ")
lineData$ = strRep$(lineData,ドル"&","and")
lineData$=left$(lineData,ドルlen(lineData$) -3)
lineData$= strRep$(lineData,ドルsep,ドル";")

if linedata$ <> " " then
for idx=1 to 10
token$(idx) = word$(lineData,ドル idx, ";")
next idx

html "<TR>"
html "<TD>";token$(1);"</TD>"
html "<TD>";token$(2);"</TD>"
html "<TD>";token$(3);"</TD>"
html "<TD>";token$(4);"</TD>"
html "<TD>";token$(5);"</TD>"
html "<TD>";token$(6);"</TD>"
html "<TD>";token$(7);"</TD>"
html "<TD>";token$(8);"</TD>"
html "<TD>";token$(9);"</TD>"
html "<TD>";token$(10);"</TD>"
html "</TR>"

print #f, """";left$(lineData,ドルlen(lineData$) -2)
end if

lineBeg = lineEnd + 1
lineEnd = instr(tblData,ドル"</tr>",lineBeg)
wend

'print "----------------- end <table> --------------------------"
print #f, ""

html "</table>"

goto [tbl2]

[endTbl]
close #f
' print "--------------- That's all folks -----------------------"
end div

div footer
html "© Metropolis 2015"
end div


end div
wait

[Opt2Find]
call alert "Not Coded Yet"
wait

[linkAction]
call alert "Not Coded Yet"
wait

sub alert message$
html "<script type='text/javascript'>
function disp_alert() {
alert('Attention!' + '\n' + '";message$;"');
}
</script>"
html "<script type='text/javascript'> disp_alert() </script>"
end sub


' ---------------------------------.--------
' strip junk
' -----------------------------------------
FUNCTION strip$(str$)
strip$ = ""
for i = 1 to len(str$)
a$ = MID$(str,ドルi,1)
a = ASC(a$)
if a > 31 then
if a < 127 then
if a$ <> "'" then
if a$ <> """" then
strip$ = strip$ + a$
end if
end if
end if
end if
next i
END FUNCTION

' --------------------------------
' string replace rep str with
' --------------------------------
FUNCTION strRep$(str,ドルrep,ドルwith$)
ln = len(rep$)
ln1 = ln - 1
i = 1
while i <= len(str$)
if mid$(str,ドルi,ln) = rep$ then
strRep$ = strRep$ + with$
i = i + ln1
else
strRep$ = strRep$ + mid$(str,ドルi,1)
end if
i = i + 1
WEND
END FUNCTION

' --------------------------------
' Replace HTML <tags> with$
' --------------------------------
FUNCTION tags$(tag,ドルwith$)
i = instr(tag,ドル"<")
j = instr(tag,ドル">",i)
WHILE j > i
tag$ = left$(tag,ドルi - 1) + mid$(tag,ドルj + 1)
i = instr(tag,ドル"<")
j = instr(tag,ドル">")
WEND
tags$ = tag$
END FUNCTION

Sub setCSS
CSSID #Container, "{
align center
margin-left: auto;
margin-right: auto;
width: 70%;
Margin: 20px Auto;
Background-Color: #C6C6B8;
Font-Family: Tahoma;
Font-Size: 1em;
Font-Weight: Bold;
Text-Align: Center;
Color: Black;
Width: 1000px;
Height: 710px;
Padding: 20px 20px 0px 10px;
Border-Color: #45453D;
Border-Size: Thick;
Border-Style: Ridge;
Border-Bottom-Style: Ridge;

}"
cssid #navigation, "{
font-family: Tahoma;
font-size: small;
color: #CC0000;
border-right: 3px solid #666666;
background: #ADAD99;
padding: 4px;
width: 250px;
height: 570px;
float: left;
white-space: normal;
background-repeat: repeat;
background-image: url('/pagebg.PNG');
Text-Align: Center;
}"
'********************************************************



CSSID #footer, "{
Background-Color:#77776E;
Font-Family: Verdana;
Width: 700px;
Height: 25px;
Padding: 0px 5px 5px 5px;
Text-Align: Center;
}"

CSSID #mytable, "{
Font-Family: Verdana;
Font-Size: .75em;
Padding: 10px 10px 0px 0px;
Width: 725px;
Height: 570px;
Background-Color: #FFFFFF;
overflow-y: scroll;
}"


CSSID #h1, "{
font-family: Tahoma;
display: block;
font-family: Tahoma;
color: #3D3D1F;
font-size: 2em;
margin-top: 0.67em;
margin-bottom: 0.67em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}"
End Sub

Last Edit: Apr 25, 2015 1:15:07 GMT -5 by metro
Intel Core2 QUAD CPU @2.54 x 4 Mint Linux 19.3 Mate
StefanPendl
Global Moderator
*****

StefanPendl Avatar

Run for BASIC ...
Posts: 945

Post by StefanPendl on Apr 25, 2015 5:11:13 GMT -5

Indent your code to make sure you see the nested divisions.
I would not mix RB and HTML divisions, since you don't see the nesting good.

Don't use attributes no longer supported with HTML 5, make sure to always use CSS, which in turn is more portable.

I think there is something wrong with your nested devisions and mixing HTML with RB devisions.
[b]Stefan[/b] - [a href=http://stefanpendl.runbasichosting.com/]Homepage[/a][br][br][b]Please give credit if you use code I post, no need to ask for permission.[/b][br][br]Run BASIC 1.01, Fire-/Waterfox (IE11, Edge), Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
metro
Full Member
***

metro Avatar

Posts: 207

Intel Core2 QUAD CPU @2.54 x 4 Mint Linux 19.3 Mate