开发者

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

开发者 https://www.devze.com 2023-03-23 14:36 出处:网络
The function is not called when I pass arguments to a js function by means of the webview.evalJS method:

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

精彩评论

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

关注公众号