0

RE: Client Side Programming - Javascript - eval()

asked 2010-08-24 14:29:25 +0800

vpupkin gravatar image vpupkin
30 1

After compilation this Doc-Page my HelloZK looks like:

<window id="win" border="normal" width="600px" xmlns:w="http://www.zkoss.org/2005/zk/client">
<textbox id="textToEval" value ="1+2"  onChanging="resultLabel.value=event.value"/>
<label value=" Hello ZKalkulator! Just try to edit expression in the text field to get result..." id="resultLabel">
            <attribute w:name="setValue">
            function (value) {
                  this.$setValue(value); //call the original method
                  if (this.desktop) {
                        this._flag = !this._flag;
                        this.setStyle('background:'+(this._flag ? 'red':'green'));
                        this.$setValue( eval ( ''+value+'') ) ;
                   }
            }
            </attribute>
</label>
</window>

So, its works (WONDERFULL even on ONLINE_DEMO!) as good as should...
.. till expr-eval-error. How can i process wrong expression-evaluation otherwise?

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest
link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-08-24 14:29:25 +0800

Seen: 330 times

Last updated: Aug 24 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More