> If I run:
> <script>return store.getTaggedTiddlers("CA2009").length </script>
> I get nothing...
> If I run:
> <script>return "No.= " + store.getTaggedTiddlers("CA2009").length </
> script>
> I get No.= 6
> the right answer!
In order to render output, the return value from an inline script must
be a text string. Try this:
<script>return store.getTaggedTiddlers("CA2009").length.toString(); </
script>
> but how can I assign it to a variable for later use...
Variables declared within an inline script are only in scope until the
end of that script. To store a persistent variable, you can
explicitly declare it in the global 'window' context, like this:
<script>window.someVariable=store.getTaggedTiddlers
("CA2009").length;</script>
and, to keep the global 'namespace' cleaner, especially when storing
multiple values, you can create your own global object and then save
the values within that object, like this:
<script>
window.myData = {}; // empty object
window.myData.someVariable = ...
window.myData.someOtherVariable = ...
</script>
enjoy,
-e
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---