itrollmework 0 Posted November 26, 2015 Report Share Posted November 26, 2015 function changeBtn(btn) { if (! btn.style) { alert("Big no for you and dont ask y, just cant do it D:"); return; } btn.style.background = "#00FF00"; btn.style.color = "black"; return; } <input type="button" id="btn1" value="glowwwww!!!" onclick="changeBtn(this)"></td> so i found this code on the internet, and it is very useful... sadly.... every time i refresh the page the button will go back to default color... how can i make it stay green even tho i refresh the page??? thankyou Quote Link to post Share on other sites
dsonesuk 913 Posted November 26, 2015 Report Share Posted November 26, 2015 This is JavaScript topic, NOT Java, they are different. You cannot truly make it permanent with JavaScript, you can store its current styling using cookie, or using web storage, but if the user clears cache/history it will revert to original state. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.