js事件自动执行

文章自动评论

setInterval(function(){
    var text=document.getElementsByTagName("textarea")[0];
    var eventtext = document.createEvent('Event');
    eventtext.initEvent('focus', true, false);
    text.dispatchEvent(eventtext)
    text.value="1111"+Math.random();
    (function(){
        var text=document.getElementsByTagName("textarea")[0];
        var eventtextkey = document.createEvent('Event');
        eventtextkey.initEvent('change', true, false);
        text.dispatchEvent(eventtextkey);
    })();
    (function(){
        var text=document.getElementsByTagName("textarea")[0];
        var eventtextkey = document.createEvent('Event');
        eventtextkey.initEvent('compositionend', true, false);
        text.dispatchEvent(eventtextkey);
    })();
    (function(){
        var text=document.getElementsByTagName("textarea")[0];
        var eventtextkey = document.createEvent('Event');
        eventtextkey.initEvent('compositionstart', true, false);
        text.dispatchEvent(eventtextkey);
    })();
    (function(){
        var text=document.getElementsByTagName("textarea")[0];
        var eventtextkey = document.createEvent('Event');
        eventtextkey.initEvent('input', true, false);
        text.dispatchEvent(eventtextkey);
    })();
     (function(){
        var text=document.getElementsByTagName("textarea")[0];
        var eventtextkey = document.createEvent('Event');
        eventtextkey.initEvent('keydown', true, false);
        text.dispatchEvent(eventtextkey);
    })();

       (function(){
        var a=document.getElementsByClassName("btn-send")[0];
        var event = document.createEvent('Event');
        event.initEvent('click', true, false);
        a.dispatchEvent(event);
        })()
},3000)

你可能感兴趣的:(js事件自动执行)