HTML guidance
I am thinking about a project involving the Prop and the Spinerret. The Spinerret will host a webpage that for conversations sake here, let's say that it has a simple page with a couple of big numbers placed on the page that use a specific font.
Let's say that when you first pull up the page it will have 2 zero's on the page and if you click on either number it will invoke a command through the Propeller to increment that number by 1 on the device to which it is connected.
So here is where I am at a cross road-
1. Do I write some HTML code that on its own can increment the number when clicked and then send the "new" number from the webpage through the Spinerret to the device?
2. Do I write some HTML code that when you click on a number it just sends an "increment command" to the device and then let the device report back to the webpage the new value?
And the second part of my question is what sort of code should I use to write this HTML code? Can it be done with just plain HTML code or does it need to be Java or something else? I don't know a lot about HTML but want to learn. I am looking for guidance- in other words what do I need to go study and where can I find some examples that may be close to what I am wanting to do?
Thanks.
Don
Let's say that when you first pull up the page it will have 2 zero's on the page and if you click on either number it will invoke a command through the Propeller to increment that number by 1 on the device to which it is connected.
So here is where I am at a cross road-
1. Do I write some HTML code that on its own can increment the number when clicked and then send the "new" number from the webpage through the Spinerret to the device?
2. Do I write some HTML code that when you click on a number it just sends an "increment command" to the device and then let the device report back to the webpage the new value?
And the second part of my question is what sort of code should I use to write this HTML code? Can it be done with just plain HTML code or does it need to be Java or something else? I don't know a lot about HTML but want to learn. I am looking for guidance- in other words what do I need to go study and where can I find some examples that may be close to what I am wanting to do?
Thanks.
Don
Comments
After you gain some experience with HTML (and only then), you will probably want to enhance the page's performance by incorporating some Javascript techniques.
-Phil
Read up on html forms and how they post to a server. You might need to add onclick handlers to one of the buttons because usually only one can cause a form to submit.
http://www.w3schools.com/html/
<html> <head> <title>test</title> <style type="text/css"> #counter {width:100%;text-align:center;} #counter a {color:green;font:bold 48px comics;text-decoration:none} </style> </head> <body> <div id="counter"> <a href="your_url_to_increment">00</a> </div> </body> </html>
Clicking on the number sends a HTTP request for an update (of course you need to change that URL to something useful).
Change the style to make it look like you want. On the w3school link provided by Mike G you'll also find css/javascript references and tutorials.
Making a specific increment request can be done by using javascript and AJAX techniques, not so difficult to do either but you'll want to read up a bit on that (you'll read a lot about frameworks when you do that, but it can be done without)
If there are any other suggestions or webpages that someone has seen that I can "tear apart" please say so. Thanks.
When you get to Javascript, this will be almost mandatory:
Mine are both well-worn and dog-eared.
-Phil