开发者

webview.evalJS(). not working when calling a js function by passing arguments in html file

The function is not called when I pass arguments to a js function by means of the webview.evalJS method:

var webview = Titanium.UI.createWebView({
    url:'changefont/index.html'
});
开发者_高级运维done.addEventListener('click',function(){                             
    webview.evalJS("changeFontProperty(selected_font,selected_fsize);");
});

and the function in the HTML file is:

function changeFontProperty(cssProperty,fontValue) {
    $('body').css(cssProperty, fontValue);
}


I tried some methods and I got it like this..

We have to call the method like this...

    webview.evalJS("changeFontProperty('" + selected_font + "','" + selected_fsize + "');");

So my problem is solved.

It may be helpful to others...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜