Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript help

Status
Not open for further replies.

jerrelle630

Technical User
Joined
Jan 16, 2006
Messages
5
Location
US
i am creating a roster page for a wretling website. now on the page i have the thumbnails with a static background. rollover them and they turn clear, easy enough. on the right i have an area with 2 boxes, on the top i want the name of the thumbnail to pop up when you roll over thge thumbnal itself. now when you click on the thumbnail i want a larger image to appear in the top and the bio to appear at the bottom. any tips or javascripts to make this a little easier?
 
What have you got so far?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
as far as i can see, i would have to make a seperate html document for each image and bio to appear when you click on the thumbnail. how ever, i'm still having issues with making the roll over on the thumbnail AND have a name appear in the iframe at the same time.
 
Obviously, you're working on the assumption that user's have JavaScript enabled. That's okay if that's what you want. Just keep in mind it might not be true for everyone.

You can dynamically build the image pages as:
Code:
<img name='thumbnail_player_55' onclick='loadIframes(55)' />

...

<script>
function loadIframes(playerNo)
{
 var d = document.frames['pictureIframe'].document;
 d.open();
 d.write("<html><body><img src='/images/player_"+playerNo+"' /></body></html>");
 d.close();
}
</script>

Let's start with that. Can you get something like that working?

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
so i have loaded the script and i have replaced "img name='thumbnail_player_55' onclick='loadIframes(55)'" with directory "img name='jeffjarrett.html' onclick='loadIframes(jeffjarrett.html)'" however when i preview, there is only the tag showing where the script would be located. am i loading it improperly or do i need to put in the entire directory?
 
The jeffjarrett.html in the call to loadIframes should be in quotes. You're sending it as a String. Careful of quotes-in-quotes. Try again and report back. Let's see some actual code (both from the page... the IMG tag and IFRAME tag... and the SCRIPT section).

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Also, if you're going with a pre-built jeffjarret.html page, for example, you can change the script to:

Code:
<script>
function loadIframes([red]loc[/red])
{
 document.frames['pictureIframe'].document.location = loc;
}
</script>

How's it coming?

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
i have tried <script><img name='jeffjarrett.html' width="254" height="174" onclick='loadIframes ("jeffjarrett.html")'</script> with the jarrett document in different tags and still no results. call me script deficient.

this is what i have so far, no editting from your original because i'm just trying to get the first one loaded before i add the rest of the bios.

<img name='jeffjarrett.html' width="254" height="174" onclick='loadIframes ("jeffjarrett.html")' />

...

<script>
function loadIframes(playerNo)
{
var d = document.frames['pictureIframe'].document;
d.open();
d.write("<html><body><img src='/images/player_"+playerNo+"' /></body></html>");
d.close();
}
</script>
 
<script><img name='jeffjarrett.html' width="254" height="174" onclick='loadIframes ("jeffjarrett.html")'</script>

You wouldn't put SCRIPT tags around the IMG tag. The IMG tag goes in the body of your document (wherever the thumbnail is to be... I assume you've got that already).

Change the JavaScript function to the one I posted last and see if that helps.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
the script tag was me being lazy and not deleting it. thank you for your help, the second script works great. thanks alot, i have been racking my brain all day trying to figure it out. thanks a million.
 
'glad to be of service! I'm sure you can figure out the bio-part with the information you have now.

Have a great day!

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top