On Nov 11, 1:14 am, Eric Shulman <[EMAIL PROTECTED]> wrote:
> > In MyTiddler, I have:
>
> Because InlineJavascriptPlugin invokes uses eval() to invoke
> javascript 'on-the-fly', any function declared via an inline script is
> only available within the scope of that call to eval(). However, you
> can use an explicitly-scoped function declaration to add your
> functions to the global "window" object, which allows them to persist
> even after the eval() processing has completed.
>
> Instead of writing:
> function MyFunction() { ... }
> you should write:
> window.MyFunction = function() { ... }
>
> Thus:
>
> <html>
> <span class="button" onclick="MyFunction()">Click Me</span>
> </html>
> <script>
> window.MyFunction=function() { alert("Clicked!"); }
> </script>
>
> enjoy,
> -e
> Eric Shulman
> TiddlyTools / ELS Design Studios
Thanks Eric - that's enabled me to get a lot further. However, now
I'm having a little problem with...
>>> access 'tiddler-relative' DOM information using
>>> story.findContainingTiddler(place) (from tiddlytools)
Correct me if I'm wrong but the above seems to return the *first* (ie
topmost) tiddler in the story. If I do:
story.findContainingTiddler(event.target)
it does indeed find the "tiddler-relative" tiddler ;)
Here's a trimmed down version of what I'm using:
<html><span onclick="clicker(event);" ...
window.clicker = function(event)
{
alert(story.findContainingTiddler(place).id); // first tiddler in
story
alert(story.findContainingTiddler(event.target).id); // this tiddler
}
Now, in reality of course, my code is a lot more complex than the
above - involving Udo's forms and data plugins, along with your
InlineJS plugin. However, a pretty straightforward top-of-the-
function call in an event handler to story.findContainingTiddler is
pretty much the same as the above trimmed down version... right?
OTOH, I find it hard to believe that place is broken ...
TW: 2.4.1
InlineJavascriptPlugin 1.9.3
FF 3.0.3
TIA
Ruzz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---