• home
  • forum
  • my
  • kt
  • download
  • Stock chart example

    Author: 2007-07-02 11:10:25 From:

    In the example below we will display the latest daily stock chart for a given company . A form will be displayed to the user allowing them to enter a valid stock symbol for a company . Typical symbols are MSFT for Microsoft and SUN for Sun.

    The first part checks to see if there has been an entry on the form , if not the form is displayed again .

    <%
    If Request.Form("ticker") = "" Then
    %>
    <html><body>
    <form action = <%= Request.ServerVariables("SCRIPT_NAME") %> method = post>
    Enter your ticker symbol :<input type = text name = ticker size = 6><br>
    <input type = submit value = "show chart">
    </form>
    </body></html>
    <%

    If a user does enter a ticker symbol then the appropriate chart is displayed using the code in the second section.

    else
    %>
    <html>
    <head>
    </head>

    <img border="0" src="http://ichart.yahoo.com/t?s=<%= Request.Form("ticker")%>">
    </body>
    </html>
    <%
    End If
    %>

    The complete code is displayed below



    <%
    If Request.Form("ticker") = "" Then
    %>
    <html><body>
    <form action = <%= Request.ServerVariables("SCRIPT_NAME") %> method = post>
    Enter your ticker symbol :<input type = text name = ticker size = 6><br>
    <input type = submit value = "show chart">
    </form>
    </body></html>
    <%
    else
    %>
    <html>
    <head>
    </head>

    <img border="0" src="http://ichart.yahoo.com/t?s=<%= Request.Form("ticker")%>">
    </body>
    </html>
    <%
    End If
    %>


    discuss this topic to forum

    relation tutorial

    No relevant information

    New

    Hot