onbeforeload


Trigger onbeforeunload if form is not submitted

流过昼夜 提交于 2019-12-18 17:14:00
问题 I've got a form which is being submitted via PHP with 3 submit actions: Save and Continue Save and Exit Exit without Saving I'd like to trigger an "OnBeforeUnload" alert to display if the user DOES NOT click on any of the form actions to advise them that they're leaving the page, and their changes may not be saved. I've tried the following code but it seems as though the unbeforeunload is being triggered before my click event. Any suggestions on how best to achieve this? $buttonpressed =

Change src of image before request has been sent

你离开我真会死。 提交于 2019-12-04 03:31:33
问题 I did a lot of research about this problem, but with no success. Essentially what I want to do is this: 1) Replace the src- attribute of all images with a placeholder, like 'blank.gif' 2) Add the HTML5 data-original attribute with the original image location 3) Lazyload the images (it needs the data-original attribute to work properly) What I tried without success: 1) attaching this eventlistener document.addEventListener('beforeload', doBeforeLoad, true); with this function function

工具导航Map