PDA

View Full Version : Hard to topic please take a look


Ricky55
02-22-2006, 02:49 PM
I Know I'm getting a lot of time today but I do appreciate it. I just find that I have loads of questions but I am learning loads from you guys.

Again, with reference to the site I'm working on

http://www.spenvalleykitchens.co.uk/worktops_30mm.html

You know how I'm using swap image behavior to swap images is it possible to have one of these buttons display text once clicked on. I know I could just make this an image but is there another way? or what is the best way? I don't really want to make the text an image. Could I make the button open a separate web page into this table cell? like an iframe or something??

Any suggestions very welcome.

davidj
02-22-2006, 03:29 PM
set a div with an id where you want the text to appear

<div id="texter"></div>

now write a little function...

function txt(t){

d = document.getElementById('texter');

switch(t){
case '1': d.innerHTML = "***********"; break; // for button 1
case '2': d.innerHTML = "***********"; break; // for button 2
case '3': d.innerHTML = "***********"; break; // for button 3

}

}

in the function i have *******. You need to insert your text in there which will display when each button is clicked

now on every button you have an onClick which will look somthing like..

onClick="MM_swap()"
// this fires your image function

where you have your onclick add...

onClick="MM_swap();txt('1')"

//notice i have added that function call txt() plus an argument of 1 you will need to add that function to every button but change the argument to 2 and then 3 , 4, 5 etc depending on how many buttons you have

if you have 5 buttons then you will need 5 case's in the function

domedia
02-22-2006, 03:50 PM
But honestly ricky, why don't you just open a new page? :)
The web is made out of pages, not sites. Then people can bookmark your seperate pages, it can be found in search engines, they can be linked to etc. Plus the fact that people expect links to open new pages.

Ricky55
02-22-2006, 04:08 PM
I think it will use the new page method as I only partly understand the first method. I wish I knew more about coding.

What code is that, is that java or just html?

Its actually just the first button that needs to load text so what would I do just make the first button load a new page based upon the orginal?

Thanks again

ricky

Ricky55
02-22-2006, 04:53 PM
domedia how do you mean open a new page could you just explain how this would work, bear in mind that its onlt the first button that would open text rather than the image and its the first button that would require text.

http://www.spenvalleykitchens.co.uk/worktops_30mm.html

so on this example the terracotta button would open some text rather than an image, I want the text to appear just where the image is at the moment.

domedia
02-22-2006, 05:31 PM
Create a regular link <a href="file.html>Link</a>
and let it go to a new page with the page the way you want it to look, with the terracotta text.

Ricky55
02-22-2006, 08:55 PM
Ok yes that would work but what would happen when one of the other buttons was clicked?? Would this jump back to the original page? I just don't quite know what you mean.

Sorry if i'm being a bit thick..

cheers

ricky55

domedia
02-22-2006, 09:04 PM
You would make one page for each page you want. heh sounds kinda weird doesn't it? ;)

Then make sure all your links would go to the appropiate page.
Anyone else try to explain the basics of linking to different pages on your site?

Ricky55
02-22-2006, 09:14 PM
sorry mate I thought you meant this but this would be a bit of a ball ache.

Just been messing with layers and the show / hide behaviour this appears to do what I want.

What do you think of layers are they ok to use?? whats browser support like for them?

Thanks for all your help

Ricky55

The other way would of course just be to have the text typed out and saved as an image....