|
NeverHeardOfMe wrote: I feel that the "list" of allowable file types should be an array, and the test made
against that
<html><head><script>
var fileTypeAllowed = (function(){
var ar = arguments;
return function(arg){
for(var i = ar.length;i--;){
if(arg == ar[i]){return true;}}
return false;
};})('doc','docx','pdf');
alert(fileTypeAllowed('docx'));
alert(fileTypeAllowed('docxa'));
</script>
</head>
<body>
hi
</body></html>
modified on Tuesday, September 14, 2010 12:44 PM
|
|
|
|
|
See... I knew it would be obvious....
Thanks
(Sorry for not marking your answer as "Good" - done now!)
modified on Friday, July 23, 2010 4:19 AM
|
|
|
|
|
NeverHeardOfMe wrote: See... I knew it would be obvious....
Thanks
There is nothing obvious about that code
|
|
|
|
|
Just to let you know, you spelt characters wrong in the alert() function
NeverHeardOfMe wrote: only alphanumeric charcters, hyphens, spaces
|
|
|
|
|
Ta.. I love typos - I do them all the time!
|
|
|
|