View Single Post
Old 11-07-2011, 10:35 AM   #13
whbenson
Enthusiast
whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.whbenson ought to be getting tired of karma fortunes by now.
 
Posts: 37
Karma: 493532
Join Date: May 2010
Device: ipad
Quote:
Originally Posted by gus_ View Post
bill, i have tried the exact code you posted, and it crashes sigil.

the alert window pops up twice, then a fatal error occurs.

i am using windows 7 64 bit and sigil 0.4.2

any ideas what may cause this behavior?
gus - you're right (though I think it worked before). In any case this was just to demonstrate inline javascript was ok. More typically you'd put functions in the header and call them from the text. The sample below works in sigil 0.4.2, at least on the Mac. You could also invoke this from a link with the href attribute. <a href="javascript:hitme()">hit me</a>


Code:
<head>
  <title></title>
  <script type="text/javascript">
  //<![CDATA[
function hitme() {
  alert("screen width=" + screen.width);
}
  //]]>
  </script>

</head>

<body>
  <p onclick="hitme()">hit me</p>
</body>
</html>
whbenson is offline   Reply With Quote