使用javascript与Epub交互

时间:2015-04-06 06:53:26

标签: javascript html publishing epub

我是Epub3环境的新手。我试图在我的Epub3中实现一些简单的JavaScript。我通过互联网搜索任何资源,但没有得到任何明确的信息。

我只是在输入文本框中调用'onchange'函数。但遗憾的是,我的epub中没有调用此函数。

请指导我实施相同的内容。非常感谢您的帮助。

<html>

<head>

  <title>Unknown</title>
  <link href="stylesheet.css" rel="stylesheet" type="text/css"/>
  <link href="page_styles.css" rel="stylesheet" type="text/css"/>
</head>

<body class="calibre">

  <div>

    <p>Correct the 5 mistakes underlined in the text.</p>

  </div>

  <div>

    <ol>

      <li>The two maps <u>allows</u> us to see the changes in one small town over a 300-year period. </li>
      <li>In the 1700s, the town was relatively small and <u>consists</u> of a few farms and houses gathered around a central market place and church.</li>
  <li>Transport <u>restricted</u> to horses at that time so the roads were very basic. Having said that, the roads were clearly marked and the river had a bridge running across it.</li>
  <li>
    In the present-day town, a great deal <u>changing</u>. Perhaps the most noticeable changes are those relating to transportation.
  </li>
  <li>
    Our modern-day needs are very different and so the roads <u>are improving</u> and
  </li>
    </ol>
  </div>
<p>Correct Transformation</p>
<div><ol><li>
  <input type='text' onchange="Ip1Func()"/>
</li><li>
  <input type='text'/>
</li><li>
  <input type='text'/>
</li><li>
  <input type='text'/>
</li><li>
  <input type='text'/>
</li></ol></div>
<div id="TextOP"><span>First span</span></div>


<script>
<![CDATA[
function Ip1Func()
  {
   var rDiv = document.getElementById('TextOP');
   //alert('hi');
   var result = document.createElement('span');
   var message = document.createTextNode('Hello Epub. Your are new to me.');
   result.appendChild(message);
   rDiv.appendChild(result);   
  }
]]>
    </script>
</body>
</html>

0 个答案:

没有答案