function createdisplay() {
for (var i=0;i<array.length;i=i+1) {
var set = createset(array[i])
document.getElementById("display").appendchild(set)}}
function createset(symbol) {
var set = document.createElement("div")
addchart(set,symbol);addlinks(set,symbol)
return set}
function addchart(set,symbol) {
var b = "http://finviz.com/chart.ashx?t="
var t = "&ty=c&ta=1&p=d&s=l"
var chart = document.createElement("img")
var src = document.createAttribute("src")
src.value = b + symbol + t
chart.setAttributeNode(src)
var style = "width:150px;float:left"
chart.setAttributeNode(style)
set.appendChild(chart)}
function getfvlink(symbol) {
var b = "http://finviz.com/quote.ashx?t="
var t = "&ty=c&p=d&b=1"
return b + symbol + t}
function getylink(symbol) {
var b = "http://finance.yahoo.com/echarts?s="
var t = "#{"showArea":false,"showLine":false,"showCandle":true,"lineType":"candle","range":"5d","allowChartStacking":true}
return b + symbol + t}
function addlinks(set,symbol) {
addlink(set,symbol,getfvlink(symbol))
addlink(set,symbol,getylink(symbol))}
function addlink(set,symbol,code) {
var link = document.createElement("a")
addhref(link,code);addtarget(link);addtext(link,symbol)
set.appendChild(link)}
function addhref(link,code) {
var href = document.createAttribute("href")
href.value = code
link.setAttributeNode(href)}
function addtarget(link) {
var target = document.createAttribute("target")
target.value = "_blank"
link.setAttributeNode(target)}
function addtext(link,symbol) {
var text = document.createTextNode(symbol)
link.appendChild(text)}
No comments:
Post a Comment