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
Solved

Using variable to select background image in div

Posted on 2006-07-10
2
328 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Problem I downloaded the Microsoft Internet Explorer 9 Beta, today, to give it a test drive and maybe write a review for the site, and it failed miserably and got stuck in a crash restart loop. The error message given is as illustrated below i…
I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

839 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