User-971175805 posted
I am trying to change the webpage background based on the user preferences, they have at the moment 5 background images to choose from.
When they click the background image that they want, the code-behind saves the image to a user preferences table in SQL and also updates the users cookie, when the master page is loaded a call to the cookie is made to get the image.
Public MyBg as string
MyBg = "css/image/" & Request.Cookies("tmr")("bgi")
In Code-Behind Master Page, and On the page I have
<script type="text/javascript">
window.onload = function () {
function load() {
$('#content').css('background', '#000 url(' + <%=MyBg %> + ') center');
}
}
</script>
If I view the page source code on a rendered page I can see
<script type="text/javascript">
window.onload = function () {
function load() {
$('#content').css('background', '#000 url(' + css/image/ecb.jpg + ') center');
}
}
</script>
All looks good apart from the fact NO image is in the background, can anyone help with this?