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

Posts: 1
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
 
When You Register, These Ads Go Away!
     
Old 04-14-2008, 11:05 AM Re: Image Link
chrishirst's Avatar
Super Moderator

Posts: 11,507
Location: Blackpool. UK
hardcode the image path or name, or add another parameter to the function
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-15-2008, 03:54 AM Re: Image Link
Experienced Talker

Latest Blog Post:
Long time no … erm post?
Posts: 45
Name: Matthew Bagley
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
Who am I | Free Layouts |Website Development | UK SEO
Paramiliar is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Image Link
 

Thread Tools

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

vB 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.11830 seconds with 13 queries