Jump to content

Displaying stock price

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Minti

Minti

    Newbie

  • Members
  • Pip
  • 3 posts
Hi there,

I am currently trying to get the stock price to display on a webpage and have it refresh every 5 minutes. I am a bit of a newbie to programming so i have been given some sample code and guidelines.

First of all i have the html page:

<html xmlns:v="urn:schemas-microsoft-com:vml">
    <head>
                <title>Default</title>
                <link rel="stylesheet" type="text/css" href="csse.css" />
                <script language="JavaScript" type="text/javascript" src="jse.js"></script>
    </head>

    <body onLoad="loadPrice()">
        <div id="HTMLResults"></div>
    </body>
</html>

This is calling a javascript file.

Now i need some help on how to write a javascript function in a seperate file that queries a url that i have been given.
"Please see second post below"
And return and display the symbol and the stock price.

Also how would i go about getting it to refresh every five minutes?

Any help with this would be greatly appreciated.

Cheers for taking the time to read this.
Minty

Edited by Jordan, 14 May 2008 - 01:44 PM.
Added code tags


#2
Minti

Minti

    Newbie

  • Members
  • Pip
  • 3 posts
Stock price URL:
http://products.stoc...tes?symbols=gsk

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
To display the symbol you would just need to do:

document.write(quote[0]);

The easiest way to refresh a page every xx amount of minutes is to simply put this in the <head> segments:

<meta http-equiv="refresh" content="600">

If you want to use JavaScript though you can use this function: The JavaScript Source: Page Details: Refresh Page - Automatic

#4
Minti

Minti

    Newbie

  • Members
  • Pip
  • 3 posts
Cheers for the reply.

A few questions

First of all how would i also display the stock price from that link.

And for the refresh i know i have shown a full html page but how i am actually going to do it is so that a section of a div refreshes therefore i need it to be done through javascript. So is the link you gave able to do this for me or should i be looking at something else?

Taa