Jump to content

Help defining functions for .onload - They keep conflicting


hchron28

Recommended Posts

I'm having a hard time making these two scripts run on the same page. I am not sure which function label is used for the .onload for each of the two script sources.

 

Any assistance would be greatly appreciated. Thanks in advance.

<script type="text/javascript">window.onload = function() {function 1();}</script><script type='text/javascript'>(function(d) {    var po = d.createElement('script');    po.type = 'text/javascript'; po.async = true; po.src = '//static.flnwdgt.com/build/js/hireme-sdk.js';    var s = d.getElementsByTagName('script')[0];    s.parentNode.insertBefore(po, s);})(document);</script><script type="text/javascript" defer src="//www.testimonialrobot.com/ver/latest/trobot-scr-js.php?add=false&id=mYA4NuMW&c=FFFFFF&b=trans&d=true&t=r&form=true"></script><script type="text/javascript" defer src="//www.testimonialrobot.com/tr-scroller.js"></script>

Here is my div

<div id="trobot"></div><br><div class='fln-hireme' data-username='hchron28' data-style='plain' data-type='badge' data-bg='' data-theme='' ></div>
Link to comment
Share on other sites

Have you checked to see if there are any error messages in the console?

 

If you use addEventListener you will make sure other scripts can't override your event listener. It's also unnecessary to wrap your function inside another one.

 

Instead of:

window.onload = function() {function_1();}

It should be:

window.onload = function_1;

And if you want to prevent conflicts with other scripts:

window.addEventListener("load", function_1, false);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...