Guest User

Untitled

a guest
Aug 14th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. ASP Button requires two clicks to post back?
  2. <input id="fileUpload" runat="server" type="file" style="visibility:hidden;" />
  3.  
  4. <img id="btnBrowse" alt="Choose an photo to upload..." src="images/browse.gif" />
  5.  
  6. $("#btnBrowse").click(function () {
  7.  
  8. $('input[type=file]').click();
  9.  
  10. });
  11.  
  12. function addLoadEvent(func) {
  13. var oldonload = window.onload;
  14. if (typeof window.onload != 'function') {
  15. window.onload = func;
  16. }
  17. else {
  18. window.onload = function () {
  19. if (oldonload) {
  20. oldonload();
  21. }
  22. func();
  23. }
  24. }
  25. }
  26. addLoadEvent(whatYouWantToInit);
  27.  
  28. var whatYouWantToInit_count = 0;
  29. function whatYouWantToInit() {
  30. if (whatYouWantToInit_count) { return; } // Won't let this function execute twice.
  31. whatYouWantToInit_count++;
  32. if ($('yourButton') != null) {
  33. $('yourButton').onclick = yourButton_click; //the function you want your onclick event to fire.
  34. }
  35. }
Add Comment
Please, Sign In to add comment