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
JS/php to change image and link through dropdown
Old 03-20-2005, 05:23 PM JS/php to change image and link through dropdown
Junior Talker

Posts: 2
Trades: 0
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
 
 
Register now for full access!
Reply     « Reply to JS/php to change image and link through dropdown
 

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.11397 seconds with 12 queries