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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to alternate pic with dropdown menu? 1

Status
Not open for further replies.

danielh68

Technical User
Jul 31, 2001
431
US
Hi,

I'm not sure what to call this function other than it involves a drop down menu and alternating pics. For an exact example of what I'm talking about visit:


Look at the 2004 NASCAR model and select the different themes using the drop down menu. This is exactly what I need, but the source isn't viewable.

Can someone explain to me what this is and point me to some sample code or how to do it?

Thanks in advance.
Dan
 
Not that I could condone plagarism in any way, but "the code isnt accessable"???
Heres the javascript function that does the image swap
Code:
<script type="text/javascript">

// This method is used to swap images on the document. It is triggered by
// the onChange event on a select drop-down list.
//
// parameters:
// formName - String value describing name of form
// selectName - String value describing the name of the select object of form
// itemName - String value describing the name of the itemSku attribute of form
// img - object name of image to be changed in document
function swapPhone(formName, selectName, itemName, img) {
    var i = eval('document.'+formName+'.'+selectName+'.selectedIndex');
    var p = eval('document.'+formName+'.' + selectName+ '.options['+i+'].value');
    path = p.split("|");
    var src= path[0];
    img.src=src;
    eval('document.'+formName +'.'+ 'phoneSKU' + '.value = path[1]');

}

function submitSwappedPhone(formName) {
    var formAction = '/NASApp/onlinestore/Action/ViewPhoneDetailAction';
    eval('document.' + formName +'.action = formAction');   
    var f = eval('document.'+formName);
    f.submit(); 
}

</script>

Cheech

[Peace][Pipe]
 
pulling it from "dynamic pages" will be whole lot cleaner ;-)....sounds like Motorola is BEHIND in their technology....

> need more info?
:: don't click HERE ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top