JavaScript in ASP.Net -
I have this code that wants to change the background color for the webpage after clicking a button for this webpage. No CSS, just a blank ASP.x page
and ATP: Button ID = "BTN_Hang" runat = "server" text = "Change" OnClientClick = "changeBackground)" / & gt ; & Lt; Script language = "javascript" & gt; Function changebackground () {document.body.style.backgroundColor = "#eeeeee"; document.getElementById ('& lt;% = txtBox3.ClientID% & gt;'). style.backgroundColor = "# 00FF00"; } & Lt; / Script & gt; The problem is that the change is only on click and no longer after the click. How do I make this change permanently?
Store the fact that the change has been made continuously (such as a cookie, local storage or (An AJAXi HTTP requesting server).
On page load, test the place where you are collecting data to see if it is actually stored there or not. If so, call the function that changes.
Comments
Post a Comment