javascript - How to add 2 myFunctions? -
i have added myfunction code site. no problem, works. tried add second myfunction. problem is, if ad second myfunction doesn't work. run succesfully when use 1 myfunction. tried do, changed name (myfunction2), people said me doesn't work. question now: how add 2 myfunctions?
script 1:
var myvar; function myfunction(loader) { myvar = settimeout(showpage, 3000); } function showpage(loader) { document.getelementbyid("loader").style.display = "none"; document.getelementbyid("mydiv").style.display = "block"; }
script 2:
window.onscroll = function(scroller) {myfunction(scroller)}; function myfunction(scroller) { if (document.body.scrolltop > 550 || document.documentelement.scrolltop > 550) { document.getelementbyid("content").classname = "slideup"; } }
you can't have more 1 function same name. try changing second script myscrollerfunction , when call it, change myscrollerfunction well.
no 2 functions can share same name.
Comments
Post a Comment