After an open issue that I had at o-blog git repo (https://github.com/renard/o-blog/issues/137#issuecomment-78085176) Sebastien suggest me:

I guess the best is to customize the templates to use a piece of javascript to do the job. A good place to start is the templates/pageheader.html

So if you want to add Javascript code (with functions) inside you page you just include the javascript into <script>, </script> and this into html code

#+BEGIN_HTML
<script>
function runme() {
    var arr = ["http://www.bbc.co.uk/", "http://www.yahoo.com/", "http://www.stackoverflow.com/"];
    var value = arr[Math.floor(Math.random() * arr.length)];
    alert("Would navigate to : " + value);
    // window.location = value;     // remove the comment at the beginning to actually navigate
}
</script>

<input type="button" onclick="runme()" value="Click Me!" />
#+END_HTML
blog comments powered by Disqus