javascript - How to get an image to not vanish even when the page refreshes -


so have button, , when clicked image shown, if page refreshed image disappears, , don't want that. how image stay when page refreshes.

here image show function:

<script>  function showimage()  { $("#loadingimage").show();        };  </script>    

and here button:

<input name="failure analysis lab"  style="white-space:normal;"     onclick="movetext(this.name);showimage();form1.submit() "  style="width: 272px; height: 30px;" type="button"  value="7qkd failure analysis lab" /> 

you can use sessionstorage this.

in init:

var isimage = sessionstorage.getitem('isimage');  if (isimage !== null) showimage();  function showimage() {     sessionstorage.setitem('isimage', '1');     $("#loadingimage").show();       }; 

if image has been shown value stored in temporary storage (will erased when browser closed - if want permanent use localstorage instead. support goes ie8). on refresh value checked , if exists image shown.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -