2009/8/6 ZhiTao Chen <[email protected]>:
> hi all,
> Is it possible with Wt to call a client javascript function with parameters?
> ex. There's a js function: function showMsg(msg) { alert(msg); }
> How to call it just like alert('hello'); in C++ code?
>

If you need to load a JS library, load it with WApplication::require(...).

void f(const std::string &msg)
{
  std::stringstream ss;
  ss << "showMsg(\"" << msg.c_str() << "\");";
  wApp->doJavaScript(ss.str());
}

It is your responsibility to do output filtering (escaping of special
double quotes etc) in msg.

Regards,
Wim.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to