This is normal HTML. In TW, you can't use the body tag and the script tag 
can't be inside the html tags. Then there's problem with place and stuff, 
so I suggest using the code of the function directly in the onclick handler 
of the button, like this:
    <html>
    <textarea rows="4" cols="50" id="myTextarea">
    342 Alvin Road
    Houston, Texas
    USA
    Earth
    Solar System</textarea>

    <textarea rows="4" cols="50" id="myTextarea2">
    Nothing here</textarea>

    <p>Click the button to copy the highlighted content to myTextarea2.</p>

    <button type="button" onclick="var txt = 
document.getElementById('myTextarea'); var start = txt.selectionStart; var 
finish = txt.selectionEnd; var sel = txt.value.substring(start, finish); 
document.getElementById('myTextarea2').value = sel; 
document.getElementById('demo').innerHTML = sel+' was extracted from 
Textarea 1 and pushed into Textarea 2';">Copy highlighted</button>

    <p id="demo">Nothing yet</p>
    </html>

This works in TWC.

w


On Saturday, January 3, 2015 8:20:20 PM UTC+1, Stephen Kimmel wrote:
>
> One of my javascript routines that I've been trying to convert from a 
> regular html file to a tiddlywiki contains a group of lines that look like 
> this:
>
> var txt = document.getElementById("myTextarea");
>> var start = txt.selectionStart;
>> var finish = txt.selectionEnd;
>> var selected = txt.value.substring(start, finish);
>>
>>
> which returns the portion of the text inside the textarea "myTextarea" as 
> selected. The routine seems to work fine outside a TiddlyWiki environment 
> but getting it to work inside TiddlyWiki has defeated me so far. It seems 
> that the first statement is probably the culprit. 
>
> Is this sort of operation even possible in TiddlyWiki?
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to