简体   繁体   English

需要在页面加载时自动点击 Javascript URL

[英]Need to click Javascript URL automatically on page load

I am using below Javascript function for the Link in the homepage.我正在为主页中的链接使用以下 Javascript 函数。 Requirement is to link clicked automatically on page load.要求是在页面加载时自动点击链接。

Link-关联-

document.writeln("<a href=\"javascript: live_chat_link(m_sTicketType,1);\" class=emp onmouseover='window.status = \"Live Chat\"; return true;' onmouseout=\"window.status = window.defaultStatus; return true;\">Live Chat</a>");

I have tried below steps like adding document.getElementById('zautoclick').click();我尝试了以下步骤,例如添加document.getElementById('zautoclick').click(); and added id="zautoclick" before href but the problem is that my page does not show the link neither it loads the second page which comes after clicking on Live Chat.并在href之前添加了id="zautoclick"但问题是我的页面既没有显示链接也没有加载单击实时聊天后出现的第二页。

Please share some logic to work auto click in my scenario.请分享一些逻辑以在我的场景中自动点击。

try this out 1)试试这个 1)

$(function() {
    $('#watchButton').click();
});

2) 2)

window.ready=function(){
  document.getElementById("linkid").click();
};

3) 3)

window.onload=function(){
  document.getElementById("linkid").click();
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM