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
Post a Comment