Jump to content

Recommended Posts

Posted

Hi,

 

I'm currently learning to create web pages using Dreamweaver and have also written some Javascript to read and interpret a post(zip)code. My problem is that I want to display different images depending on the post(zip)code and it's not obvious to me how you do this. There will also be a different number of images that are post(zip)code dependent. I would want the first image to be placed top left of the page, the next to its right, the next to its right, etc. Can anyone point me to the construct that will allow me to do this? I'm not looking for any actual code as finding out how to do things is half the fun; I just need pointing in the right direction.

 

Regards,

 

Tony

  • 3 weeks later...
Posted

You can do this with Javascript and DOM scripting. You would have to load your collection of zip codes into say a Javascript associative array, where you would pair up your zip codes to images.

 

Once a zip code is selected, you could loop through your array and then use the DOM to set display the image.

 

Hint: Look at 'innerHTML'.

 

Try it with a simple array first and then expand from there.

 

Stefan

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...