Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 04-13-2008, 04:20 PM Image Link
Junior Talker

Posts: 1
Trades: 0
Hi I have a little problem. The script below deals with layoutButton function but the problem is that the image and the link must have the same name.
Is there any way to make the name of the link and the image different?
I have 6 different paths for my links but need only 1 path for the image.
Hope it's clear enough.
Thanks,


<table cellpadding="0" cellspacing="0" style="{width: 134px;}"><tbody><tr><td><img width="134" height="25" alt="Updates" src="table/right/layouts.gif" border="0"></td></tr><tr><td class="rightbox">
<script type="text/javascript">
function layoutButton(name, title){
document.write('<td style="border: 1px solid #000000">');
document.write('<a href="'+name+'.html">');
document.write('<img src="images/'+name+'.gif" alt="'+title+'" style="border: 0px" />');
document.write('</a>');
document.write('</td>');
}
document.write('<div align="center"><table cellpadding="0" cellspacing="0" style="border: 0px solid #000000; border-collapse: collapse"><tr>');
layoutButton('1', 'example 1');
layoutButton('2', 'example 2');
document.write('</tr><tr>');
layoutButton('3', 'example 3');
layoutButton('4', 'example 4');
document.write('</tr><tr>');
layoutButton('5', 'example 5');
layoutButton('6', 'example 6');
document.write('<td>&nbsp;</td>');
document.write('</tr><tr>');
document.write('</tr></table></div>');
</script>
</td></tr></tbody></table>
Dgolverk is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-14-2008, 12:05 PM Re: Image Link
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
hardcode the image path or name, or add another parameter to the function
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-15-2008, 04:54 AM Re: Image Link
Experienced Talker

Latest Blog Post:
Long time no … erm post?
Posts: 45
Name: Matthew Bagley
Trades: 0
ok where you have
function layoutButton(name, title){
document.write('<td style="border: 1px solid #000000">');
document.write('<a href="'+name+'.html">');
document.write('<img src="images/'+name+'.gif" alt="'+title+'" style="border: 0px" />');
document.write('</a>');
document.write('</td>');
}
#
change it for this
Code:
function layoutButton(name, link, title){
document.write('<td style="border: 1px solid #000000">');
document.write('<a href="'+link+'.html">');
document.write('<img src="images/'+name+'.gif" alt="'+title+'" style="border: 0px" />');
document.write('</a>');
document.write('</td>');
}
that way you can pass along a second variable called link, this will be the link to the page that you want to load, so your call would look something like

Code:
layoutButton('1', '/path/to/url/1', 'example 1');
hope that helps
__________________
Matthew Bagley
Paramiliar Design Studios

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Paramiliar is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Image Link
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14489 seconds with 12 queries