Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help With Table And Image Change

Featured Replies

Hi,

 

I have a javacript code which changes the colour of my table cell when i mouse over BUT my problem is I want it to also change a image i have inserted within the cell.

 

See here - http://www.360italy.com/newlayout.htm

 

I have placed just a normal rollover on the first image which changes it from a faded image to the normal clear image and what i want it to do is when I mouseover the table cell the background changes to the turqouise colour as normal and also the image changes to whatever one i specify.

 

Can anyone help me?

 

Thanks

Hi,

 

Welcome to the forum.

 

A couple of things mate.

 

I'm a bit of a purist so don't take it personally.

 

Your code is a total mess dude.

 

Firstly, you don't need JavaScript to achieve what you're after. Simple XHTML and CSS will do the trick.

 

Secondly, don't use tables for layout. It's so 1998 and it's wrong. ;)

 

Thirdly, use external files such as external stylesheets and JavaScript files and then reference them in your HTML. That's best practice for a number of reasons.

 

Hope this helps. :)

Agreed, I think you might have over complicated the site.

  • Author

Hi,

 

Welcome to the forum.

 

A couple of things mate.

 

I'm a bit of a purist so don't take it personally.

 

Your code is a total mess dude.

 

Firstly, you don't need JavaScript to achieve what you're after. Simple XHTML and CSS will do the trick.

 

Secondly, don't use tables for layout. It's so 1998 and it's wrong. ;)

 

Thirdly, use external files such as external stylesheets and JavaScript files and then reference them in your HTML. That's best practice for a number of reasons.

 

Hope this helps. :)

 

Hi Buddie,

 

Many thanks for your reply and suggestions but other than tables i have never used divs or anything, looks very hard to use.

 

Also I still dont know how to do what i asked, could you explain it on how i would achieve this?

 

Many Thanks

Jamie

Hi,

 

No problem.

 

Using XHTML and CSS is far easier and far less problematic than using tables for layout and JavaScript for rollover effects and the like.

 

I would suggest starting with W3C Schools paying specific attention to the CSS Box Model and CSS floats.

 

It would take you a couple of days to learn to build a site like yours using only XHTML and CSS. It's quite easy to learn and once you have you will never look back, that I promise.

 

It will save you a hell of a lot of time and effort in the future, trust me. If you're going to do this for anything other than a hobby, you really need to learn the correct way of doing things, best practices and professional skills.

 

Hope this helps. :)

  • Author

Hi,

 

No problem.

 

Using XHTML and CSS is far easier and far less problematic than using tables for layout and JavaScript for rollover effects and the like.

 

I would suggest starting with W3C Schools paying specific attention to the CSS Box Model and CSS floats.

 

It would take you a couple of days to learn to build a site like yours using only XHTML and CSS. It's quite easy to learn and once you have you will never look back, that I promise.

 

It will save you a hell of a lot of time and effort in the future, trust me. If you're going to do this for anything other than a hobby, you really need to learn the correct way of doing things, best practices and professional skills.

 

Hope this helps. :)

 

 

Ok cool thanks very much.

 

But in the meantime could you tell me how to do what i asked in my first post?

 

Many Thanks

Jamie

Anyone?

 

Thanks

Jamie

 

You would have a div that you assign a class to. The styling of the div would then be controlled using css. To display the background image, you would just need to add a class:hover attribute and set the background image.

 

For example

 

HTML

<div class="hotel-box">Enter your hotel description and image in here.</div>

 

CSS

.hotel-box:hover {background-image:url('bgimage.jpg');}

 

That's a very simple explanation but will hopefully be a good start.

  • Author

Use HTML and CSS very easy

 

 

Lol so someone has said, but im not that experienced that i can just go do it myself, i need some help.

 

If you can provide the code i have to use etc that would be great.

 

Thanks

Monty

  • Author

You would have a div that you assign a class to. The styling of the div would then be controlled using css. To display the background image, you would just need to add a class:hover attribute and set the background image.

 

For example

 

HTML

<div class="hotel-box">Enter your hotel description and image in here.</div>

 

CSS

.hotel-box:hover {background-image:url('bgimage.jpg');}

 

That's a very simple explanation but will hopefully be a good start.

 

 

Many thanks for this!

 

Ok i have inserted the code into the first box, my prob now is that the fade in the image only dissapears when you hover over the text, i need the fade to dissapear as soon as your arrow goes over the whole box and not just the text.

 

How do i go about doing that?

 

Many thanks

Monty

  • Author

Many thanks for this!

 

Ok i have inserted the code into the first box, my prob now is that the fade in the image only dissapears when you hover over the text, i need the fade to dissapear as soon as your arrow goes over the whole box and not just the text.

 

How do i go about doing that?

 

Many thanks

Monty

 

 

Please can someone help me :(

 

Thanks

Monty

I'm in work at the moment so can't give you a solution right now. I will help this evening.

 

You're trying to cobble a website together based on code snippets from various places though. I advise you spend some time learning the basics of XHTML and CSS, as it will help you greatly.

I think you need to refresh your skills. Your problem is easy to solve, but I think you would learn more by researching the solution your self or spending a couple of hours a day on w3c schools. Or type your problem into Google

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.