1
我想要生成一個包含一些基於用戶的輸入參數的網址。 我有一個錨點,並通過使用addMouseDownHandler或addClickHandler我可以更改錨點的鏈接。 問題是這個改變的鏈接將被激活,只有當我第二次點擊錨點,並且(在創建時)指定的url將在我第一次點擊錨點時被激活。更改href之前錨會激活url
function onMouseDownAnchor(e)
{
Logger.log(JSON.stringify(e));// you can see the source parameter in e that returns the widgets ID of the button you clicked to call the handler
var app = UiApp.getActiveApplication();
var btnAnchor = app.getElementById('btnAnchor');
var newLink = 'http://www.google.com';
btnAnchor.setHref(newLink)
Logger.log('onMouseDownAnchor');
return app;
}
如何更改錨點的href在錨點激活其點擊它時的url?