English 中文(简体)
在只打上一页的超文本链接时,如何用点击工作来补充这一说法?
原标题:How to make this addEventListener on click work when hitting only the hyperlink in a page?

当用户在div id = 格式化ket-content 页面内任何地方点击时,Im与添加EventListener有问题,向我的网页发送该记录。 连接线是div id = 格式化提纲中的一种超链接,它需要每当用户点击时添加EventListener。

我在下述情况下尝试了什么:每当用户在div id = 格式化ket中点击时,它都会寄出该记录:

document.getElementById( formatted-ticket-content ).addEventListener("click", (linkText) => log( A link was clicked ));

在低于代码的地方,如果用户点击超链接,就只向我的网页www.hook url发送一个标识,那么它就没有做我预期的任何事情:

let eventListenerFunction = (e) => {log( A link was clicked ); }
document.getElementById( formatted-ticket-content ).forEach(linkText => {
                link.addEventListener("click", eventListenerFunction);
});

非常提前地感谢你向那些就此问题发表意见的人表示感谢。 和平!

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签