Object.prototype.isin = function()
Bonsoir,
j'ai écrit la fonction suivante :
Code:
1 2 3 4 5
| Object.prototype.isin=function()
{
for(var i in arguments[0]) if(arguments[0][i]===this) return true
return false
} |
pour déterminé si un "machin" est dans un autre.
Or, si je fait :
Code:
1 2
| tagname='INPUT'
tagname.isin(['INPUT','TEXTAREA']) |
cela renvoie : false.
En effet :
Code:
1 2 3 4 5 6 7 8
| Object.prototype.isin=function()
{
for(var i in arguments[0])
{
alert(typeof arguments[0][i]) // 'string'
alert(typeof this) // 'object'
}
} |
Une suggestion ?
Merci.