I have put a snippet of JavaScript into a Script Editor Web Part. It's function is to display an alert box and redirect the page after an Infopath form submission. I got it from this website and modified it.


 function pagecontainerload()

 function setEventHandler()
  var btnSend = document.getElementById("ButtonID");

  btnSend.onmouseup = function(){Button.OnClick(this, event); alert("Your request has been successfuly submitted.");      window.location='website.com';};

The script works fine in Chrome and IE, but not in Firefox.

Any suggestions?

  • 2
    Check the web console for errors. Better yet install firebug and check the console for errors. Jul 28, 2015 at 19:47

2 Answers 2


The problem was in the event being undefined. IE and Chrome are okay with it, but FF doesn't like it. In the last line, the code should be function(event){Button.OnClick(this, event)

  • Yeah, you are correct. I see the same issue in my browser Jul 29, 2015 at 23:27

May be something: under IE, getElementById looks for elements by ID and by name, while under FF, it's only by ID. Are you sure your ButtonID element has its ID set to ButtonID and not only its name?

If the name attribute has to be used, you may call getElementsByName instead (mind it may return more than one element).

  • Sorry, I just wrote "Button ID" in instead of the actual ID since it was so long and I didn't think it was that important. So it is not looking for the name, but the ID.
    – clew3
    Jul 29, 2015 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.