loading............
Es un problema típico de CLOSURES.
http://blog.morrisjohns.com/javascri...es_for_dummies
Pero para hacer lo que TU quieres hacer.. solo debes hacer esto
Código PHP:
function asigna()
{
d = document.getElementsByTagName('img');
for(i=0;i<d.length;i++)
{
if(d[i].className == 'imagen')
{
d[i].onmouseover=msj;
}
}
}
function msj()
{
alert(this.src);
}
Y si quieres implementar closures debes hacer lo siquiente.
Código PHP:
/***************************************************************************
* maborak.js
* ------------------------
* Copyleft : (c) 2007 maborak.com <[email protected]>
* Version : 1.2.4
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
var argumentsToArray=function(a){
var args=[];
for(var i=0;i<a.length;i++){args.push(a[i]);};
return args;
};
Function.prototype.args=function()
{
var oThis=this;
var args=argumentsToArray(arguments);
return function()
{
return oThis.apply(oThis,argumentsToArray(arguments).concat(args));
};
};
Y para usarlo
Código PHP:
function asigna()
{
d = document.getElementsByTagName('img');
for(i=0;i<d.length;i++)
{
if(d[i].className == 'imagen')
{
d[i].onmouseover=msj.args(d[i].src);
/*
Puedes pasarle cuantos argumentos quieras
d[i].onmouseover=msj.args(arg1,arg2,arg3);
*/
}
}
}
function msj(m)
{
alert(m);
}
connection closed.