[Moin-user] Selecting text

Kai Jaeger kai at aplteam.com
Sat May 12 08:49:13 EDT 2012


I would like to give the user an opportunity to select text. More
precisely: program code.
Of course I would prefer a button "Copy code" but I don't want a Flash
or a Java solution and simple JavaScript solutions seem to work only
in Internet Explorer.

Anyway, my audience are programmers, selecting the text as a result of
a click on a "Hightlight code" button is okay, they can press Crl+C
themselves.

I found some JavaScript which seems to be doing what I am after. All I
need to do is to create a link or a button that executes that piece of
JavaScript.

I took a naive approach:

{{{#!html
<button onclick="javascript:fnSelect('code01');">Hightlight Code</button>
}}}

Unfortunately Moin changes this code into
<button>Hightlight Code</button>
which naturally has no affect at all.

What is the right way to do this? My guess is that it cannot be done
without some Python code which in turn calls the JavaScript code?

Kai




More information about the Moin-user mailing list