> <script show>
> var who = parseParams({{config.options.txtUserName}});
>
> alert(who);
> </script>
When using InlineJavascriptPlugin, *everything* inside <script>...</
script> is considered to javascript code. Using {{...}} within that
code simply makes no sense. Although it does not cause an error,
{{...}} is NOT a proper use of javascript syntax. In fact, that
sequence is only defined and used by the TW core code to process 'eval
params' contained in macro calls (e.g., <<myMacro foo with: {{...code
goes here...}}>>) and cannot be used anywhere else.
config.options.txtUserName (which can also be written: config.options
["txtUserName"]) is a javascript object reference directly to the
current internal stored value for the <<option txtUserName>> input
(i.e., the current username).
parseParams() is a core function that takes a space-separated text
string (e.g., the entire parameter list from any macro call), and
breaks it apart into an complex object that contains separate text
strings for each named or unnamed parameter. So, unless the current
username consists of a space-separated *parameter* list (which is
isn't), you should not be using parseParams().
This is all you need:
<script>
var who = config.options.txtUserName;
alert(who);
</script>
Note: leave the "show" param out of the <script> syntax. It's just
for documentation purposes. Also, if you intend to use the "who"
variable later on in another inline script, you *must* explicitly
define it as a persistent global "window" variable, like this:
window.who = config.options.txtUserName;
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
--
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.