View Full Version : Dynamic text with onclick & innerHTML?


Doitsu
01-06-2011, 05:11 PM
I'm experimenting with creating bilingual epubs. I'd like to format sentences as non-underlined links that will display translations when the user clicks on them. I created an xhtml file that uses onclick to manipulate the innerHTML of an anchor element. It works fine as an xhtml file, but not when I add the file to an epub.
Is this yet another xhtml element not supported by the epub standard?
BTW, is there a list of valid xhtml elements that are currently not supported by the ePUB standard?

Jellby
01-07-2011, 04:04 AM
ePUB renderers often have no support for any scripting capabilities, and the specification certainly does not mandate any script language, and actually disencourages them. Also, the subset of XHTML supported by ePUB (http://www.idpf.org/doc_library/epub/OPS_2.0_latest.htm#Section2.2) does not include the "Intrinsic Events" module, which contains "onclick" et al.

So yes, dynamic content is largely not supported by the ePUB spec (nor by ePUB readers). In the specification linked above you have a list of what is (or should be) supported, both in XHTML and CSS.

whbenson
01-07-2011, 11:45 AM
If your target is iBooks, then your example does indeed work there, as you probably know. Javascript is also used in some of the newer educational titles in iTunes U.

Doitsu
01-07-2011, 06:33 PM
So yes, dynamic content is largely not supported by the ePUB spec (nor by ePUB readers). In the specification linked above you have a list of what is (or should be) supported, both in XHTML and CSS.
Thanks for your quick and detailed answer. I'll check out the link.