473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Changing Background image in tables

Hi All,
I am relatively new to this game and I am running up against a problem trying to change the background image in my table. The idea is that when you click on the link, the javascript will change the table background.

The table code looks like this

<table id="tableVert"
style="margin-left: auto; margin-right: auto; text-align: left; width: 100%; height: 500px; background-image: url();"
border="0" cellpadding="0" cellspacing="0">

The link

<a class="Ilinks"
href="javascript:chgImageV('images/05d-Bell solo pluie.jpg')">Bell-
Pluie</a><br>

finally the function

function chgImageV(v){
document.getElementById('tableVert').style.backgro undImage="url("v")"
}

As you can see, I am trying to get the image name to fit in where the 'v' is in the function.

What am I doing wrong.

Thanks in advance for the help.

rvanwaarden
Mar 20 '07 #1
3 1406
acoder
16,027 Expert Mod 8TB
Welcome to TSDN.

Try:
Expand|Select|Wrap|Line Numbers
  1. function chgImageV(v){
  2. document.getElementById('tableVert').style.backgroundImage="url('"+v+"')";
  3. }
Mar 21 '07 #2
Acoder,

I tried that solution and it works perfectly. I knew it was a matter of misplaced characters but couldn't figure out what went where. My day has started off well because of you answer.

Cheers.
Mar 21 '07 #3
acoder
16,027 Expert Mod 8TB
Glad I could be of help.
Mar 21 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dj Frenzy | last post by:
Hi, I know how to use javascript to change a background image to another background image, and how to change a background colour to another background colour. Is there a way to change an image to a...
3
by: Michael Eisenstadt | last post by:
What are the coding options for client-side image size changing? I want the viewer to be able to switch between two different sizes of the same image with his/her mouse. Thanks in advance for...
5
by: Doug Laidlaw | last post by:
HTML validators say that "background" is not a valid attribute for a <td> tag I want to set an image as the background for one cell only, and to have the cell content on top of it. If I can't...
0
by: zeckdude | last post by:
Hi, I am having some issues with my site. I have a main Nav with four links that load in 4 different sections. You can see the page I am working on here:...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.