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
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