For some reason, I cannot use jquery.模擬鏈路(<a href='dd'>) click with javascript
With plain javascript, how could I simulate the link-click action on a web page.
Thanks.
Below is the javascript I tried to get online, but it seems not work.
function create_window (title, content){
var comment = document.getElementById('modal');
alert(comment.innerHTML);
if (comment.click) {
alert('hi');
comment.click();
} else if (document.createEvent) {
alert('3');
var ev = document.createEvent('MouseEvents');
ev.initMouseEvent('click', true, true, window, 1, 12, 345, 7, 220, false, false, true, false, 0, null)
comment.dispatchEvent(ev);
}
}
抱歉,但是這一點,我只是得到一個警報彈出「取消」 ... –
我會希望用戶點擊被點擊與模擬... –
嗨Asad,與小提琴,你認爲我需要嵌入像jquery或motools一些圖書館使它工作? –