我想通过在vaadin代码中执行这个字符串来调用js函数:
String js = "function returnURL{" +
"return(window.location.href.replace(/(\\d+)$/, function(str, p1, p2) {" +
"return((Number(p1) + 1) + p2);" +
"}));" +
"}";如何通过这种方式正确调用此函数:
Page.getCurrent().getJavaScript().execute(javascript function);发布于 2014-01-12 08:35:05
你的js代码中有一个小错误,你应该有:
String js = "function returnURL(){" + //Check the parens here
"return(window.location.href.replace(/(\\d+)$/, function(str, p1, p2) {" +
"return((Number(p1) + 1) + p2);" +
"}));" +
"}";然后:
Page.getCurrent().getJavaScript().execute(js);希望这能有所帮助。干杯
https://stackoverflow.com/questions/21069648
复制相似问题