need help on color selection

Discussion in 'C#' started by maven, Nov 12, 2006.

  1. #1
    hey guys, i have a script below for color selection which I got from a source . it works and it shows the color of the tshirt when i click the color thumbnails. but i would like to have a textbox that displays the word of the color when i have select the colour. is there anyone knows how to do this. also since this t-shirt has a pproduct code, how can i incorporate into the script below?
    <script>
    var selectedCell=null;
    
    function depressCell(color){
    	var cell=null;
    	if (""+color=="undefined"){
    		cell=window.event.srcElement
    		}
    	else {
    		cell=document.all(color);
    		}
    	if (cell.tagName=="TD"){
    		if (selectedCell!=null){
    			selectedCell.style.border="outset 2pt #D0D0D0"
    			}
    		cell.style.border="inset 2pt #D0D0D0"
    		selectedCell=cell;
    		updateResult(cell)
    		}
    	}
    
    function updateResult(cell){
    	displayCell.style.backgroundColor=cell.style.backgroundColor;
    	displayCell.align="center";
    	displayCell.valign="middle";
    	displayCell.style.fontWeight="bold";
    	if ((cell.title=="White")||(cell.title=="Yellow")){
    		displayCell.style.color="#000000";
    		}
    	else {
    		displayCell.style.color="#FFFFFF";
    		}	
    	tshirtImage.src="images/TShirt"+cell.title+".jpg";	
    	}	
    swatches.onmousedown=depressCell
    depressCell("White");
    
    </script>
    
    Code (markup):

     
    maven, Nov 12, 2006 IP