Hi !
On 12/21/2012 04:58 AM, Hongbo Zhang wrote:
On 12/20/12 3:31 PM, Pierre-Etienne Meunier wrote:
Hi,

Personally, I learnt js_of_ocaml by first learning javascript using firebug in firefox. They have something called the console, similar to a toplevel, where you can directly manipulate the DOM to see what you are supposed to do with javascript, and immediately see the results on the webpage. Make a simple webpage, the most important point is that your elements all have a property called "id", and try to play with this toplevel before understanding it. A typical example is :
Thanks for your message, it's really helpful ;-)
<html>
<body>
<div id="example">
Blabla
</div>
<p id="aparagraph">
Blibli
<p>
</body>
</html>

Then, in order :

- try to make a table programmatically (using the Mozilla Developper Library).
- use httprequests.
- animate svg pictures
- use canvas.

Then if you learn about what javascript calls "prototypes", you're done learning javascript, and you can do all this in ocaml.

Good luck
Pierre


Em 20/12/2012, às 17:41, bob zhang escreveu:

Dear List,
    I tried several times using js_of_ocaml, but did not get a working example yet, it  always gives me some error message like missing some primitives.
    I am absolutely a newbie in javascript, is there some simple working examples online?

    I followed this thread, http://toss.sourceforge.net/ocaml.html, but the output JsClient.js does not work as I expected
    Thanks in advance!

-- 
Regards
-- Bob


Are you aware of this page : http://try.ocamlpro.com/js_of_ocaml/
We put some examples and you can try them online.

You can also look at the source of TryOCaml, it can be a start :-)
-- Çagdas