当页面被访问时,自动点击页面上的锚链接 [英] Auto click an anchor link on the page when the page is visited
本文介绍了当页面被访问时,自动点击页面上的锚链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
之前我问过这个问题,但有些专家告诉我要添加
I asked this question before but some of the experts told me to add
<meta http-equiv="refresh" content="2;url=http://www.example.com/" />
可以重新加载给定的链接,但我想知道如何在帮助中单击元素(锚点)的id。是否有任何代码在执行时会点击id ='dp99',并且我希望在访问该页面时执行此JavaScript。这里是HTML
That can reload a link given but i want to know how to click an element(anchor) with help of id. Is there any code that when executed will click on a id='dp99', and i want this javascript to be executed when the page is visited. Here's the HTML
<a id='d99' href='http://someline.com'>This is a link</a>
如果有人能帮助我,我将不胜感激!谢谢。
I will be grateful if anyone can help me !! Thank you.
推荐答案
使用jQuery:
With jQuery:
$(document).ready(function() { $('#dp99').click(); });
没有jQuery:
Without jQuery:
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('dp99').click();
});
这篇关于当页面被访问时,自动点击页面上的锚链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文