Reply
JS/php to change image and link through dropdown
Old 03-20-2005, 04:23 PM JS/php to change image and link through dropdown
Junior Talker

Posts: 2
hello
i'm new here, i hope someone will find a way to help me

quickly: i need a script that allows me to change an image and the link associated to it through a dropdown menu

i was able to change the image but not the link

this is the code

PHP Code:
<?php 

$path 
// path 
$url // each image has a link to a page (with the same ID of the image) 
$totimg // size of arrays 
$stationID // array of values 
$stationNM // array of option names 

echo "<a href='$url/$stationID[0].html' target='_blank'>"
echo 
"<img src='$path/$stationID[0].gif></a>"

?> 

<SCRIPT LANGUAGE="JavaScript1.2"> 
     
function uSlct (ImgID, position) 
    {         
    document.locality.weatherID.options.selectedIndex = position; 
    replaceImage(ImgID);         
    // chbutton(document.locality.weatherID); 
    } 
         
function replaceImage(ImgID) 
    { 
    document.weatherImg.src = '<? echo"$path"?>'+ImgID+'.gif'; 
    } 
     
</SCRIPT> 

<FORM NAME="locality" METHOD="POST" > 
<SELECT NAME="weatherID" onchange="replaceImage(document.locality.weatherID.options[document.locality.weatherID.selectedIndex].value);"> 

<? 
for ($i=0$i<$totimg$i++){ 
      echo 
"<option value=\"$stationID[$i]\">$stationNM[$i]</option> "

?> 

</SELECT> 
</FORM>
thnx a lot in advance
wonderer is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Reply     « Reply to JS/php to change image and link through dropdown
 

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