Tuesday, 15 April 2014

Dynamically update html file based on form input(s) -



Dynamically update html file based on form input(s) -

i utilize site called finviz.com provides stock charts. view charts along different timeframes, 1 on top of other. have been using excel this. e.g. if come in "aapl" in cell a1, utilize simple concatenate formula in excel set hyperlinks need follows:

<img src = 'http://elite.finviz.com/chart.ashx?t=aapl&ty=c&ta=st_c,sch_100,sma2_50,sma2_20,sma2_100,stofu_b_5_3_3&p=d&s=l'><br> <img src = 'http://elite.finviz.com/chart.ashx?t=aapl&ty=c&ta=0&p=i15&s=l'><br> <img src = 'http://elite.finviz.com/chart.ashx?t=aapl&ty=c&ta=0&p=i3&s=l'>[/code]

however pretty slow going. each different ticker, need copy/paste excel text html file on desktop , refresh chrome browser. prefer have input field in html code lets me come in ticker symbol dynamically updates html code different stock.

can suggest how that?

in case don't want utilize jquery here plain javascript version of intracept's nice code.

<input type="text" id="tickercode" /><input type="button" id="setticker" value="set ticker" /> <img id="ticker1" src = 'http://elite.finviz.com/chart.ashx?t=aapl&ty=c&ta=st_c,sch_100,sma2_50,sma2_20,sma2_100,stofu_b_5_3_3&p=d&s=l'><br> <img id="ticker2" src = 'http://elite.finviz.com/chart.ashx?t=aapl&ty=c&ta=0&p=i15&s=l'><br> <img id="ticker3" src = 'http://elite.finviz.com/chart.ashx?t=aapl&ty=c&ta=0&p=i3&s=l'> <script> document.getelementbyid('setticker').addeventlistener('click', function () { var symbol = document.getelementbyid('tickercode').value; document.getelementbyid('ticker1').src = 'http://elite.finviz.com/chart.ashx?t=' + symbol + '&ty=c&ta=st_c,sch_100,sma2_50,sma2_20,sma2_100,stofu_b_5_3_3&p=d&s=l'; document.getelementbyid('ticker2').src = 'http://elite.finviz.com/chart.ashx?t=' + symbol + '&ty=c&ta=0&p=i15&s=l'; document.getelementbyid('ticker3').src = 'http://elite.finviz.com/chart.ashx?t=' + symbol + '&ty=c&ta=0&p=i3&s=l'; }); </script>

html forms

No comments:

Post a Comment