Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>switch not setting new value

switch not setting new value

nTech
03-16-2006, 10:14 PM
I can't seem to get the following code to set a new value for the var nClass. It should return "ad"


function cardClass(tmp) {
var na=tmp.split(":");
var pfx=na[0];
var sfx=na[1];
var nClass;
switch(pfx) {
case 2: nClass='a'+sfx; break;
case 3: nClass='b'+sfx; break;
case 4: nClass='c'+sfx; break;
case 5: nClass='d'+sfx; break;
case 6: nClass='e'+sfx; break;
case 7: nClass='f'+sfx; break;
case 8: nClass='g'+sfx; break;
case 9: nClass='h'+sfx; break;
case 10: nClass='i'+sfx; break;
case 11: nClass='j'+sfx; break;
case 12: nClass='k'+sfx; break;
case 13: nClass='l'+sfx; break;
case 14: nClass='m'+sfx; break;
}
return nClass;
}

document.write( cardClass("2:d") );

nTech
03-17-2006, 03:34 AM
nvm, I was comparing a string to a number... correct way is case "2" not case 2 in this instance


 

TOP

Hyperthreading hurts s
HP sharpens blade PC l
Apple goes for Quad po
Itanium gets scaled do

For more info

HP sharpens blade PC l
Hyperthreading hurts s
can not call click() i
script does not work o
smart menu 
write to an html file 
FireFox doesn't recogn
Changing e.keyCode (e.
Clearing a range creat
UPDATE: My mouse over 

News Archive

onChange Help 
beforeload? vs onload.
Problem with document.
decreasing my javascri
Problem with \\ and \ 
how to stop scrolling?
Change Label Text Colo
Can I forward a page b
2 javascript functions
Validating a textbox 

Related stories:

Move Cursor to Position in a Text Area
Problem opening popup window after form submit
Sorry Me Again, Need Help with Validating array checkboxes
is there an attribute that i can add to all types of form input
Pre-populate content from one text box into another text box
drop down menu - help needed
Dynamic Button not Handling Event
Drag n drop Thumbnail Images to iFrame, with Original Size
Help with an online order form using drop down boxes

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics