Solved

Using variable to select background image in div

Posted on 2006-07-10
2
331 Views
Last Modified: 2006-11-18
I need to set the background image to div id depending on which site someone is at. i can determine the site from the UnivID but I cannot get the background to div id frame to show up.

I am using this to check for the UnivID and try to set the background image. Images exist and are in the right location cause I can use CSS to assign the image statically, but I need it dymanic. Anyone see a problem with this code?

<% if request.Querystring("UnivID") = "1" then
                   response.write("<div id='frame' background-image: url(littlerock/images/ltrk.jpg);>")
                   else if request.Querystring("UnivID") = "2" then
                             response.write("<div id='frame' background-image: url(memphis/images/memphis.jpg);>")
                             end if
          end if %>  

0
Comment
Question by:ksilvoso
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
almes earned 125 total points
ID: 17080931
background image is a style attribute not a DIV attribute, that is why you should use:

<div id='...' style='background-image:url(...)' >

good luck...
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17107369
Thanks, that got it, altho only in IE. I will have to look around for the hack for Mozilla, or do you know what it should be?
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After uninstalling Opera browser (for example ver. 10.63), your attempts to open a web page by clicking on a URL link may fail with an error message.  The error is "This operation has been canceled due to restrictions in effect on this computer. Pleā€¦
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question