这是我的代码:
var url = f.href.value;
ed.dom.setAttribs(e, {
href : 'javascript:void(0)',
onclick: 'doSomething(' + url + ')'
});
还有 doSomething 方法:
function doSomething(url) {
windowMy = dhxWins.createWindow("externalLink", 10, 10, 630, 630);
windowMy.setText("Title");
windowMy.attachURL(url);
}
当 doSomething 被调用时,我得到错误:Uncaught SyntaxError: Unexpected token :, when url="http://somewebsite/site"。
我应该怎么办?如何在 JS 函数中将 url 作为参数传递?