hola amigos, como puedo saber el nombre del objeto que ha llamado a una funcion, p.e. tengo 4 id's diferentes que llaman a una misma, entonces como hago para saber quien llamo,
en actionscript uso algo como this._name
Código:
<table align="center" width="540" border="0" class='tablenews'>
<!-- PRINCIPALES -->
<tr>
<td colspan="2">
<div id="newscontent">Lo Principal<br /><img src="./preload_3.gif" /></div>
</td>
</tr>
<tr>
<td colspan="2">
<!-- TEMAS -->
<div id="newsthemes" style="background:#FFFFCC; display:block">
<a href="#">tema 1</a><a href="#">tema 2</a><a href="#">tema 3</a>
</div>
<!-- fin:TEMAS -->
</td>
</tr>
<!-- fin:PRINCIPALES -->
<!-- ITEMS -->
<tr>
<td id="item1" style="padding: .2em; width: 270px; height: 60px; border: thin solid
silver; background:#FFFFFF"
onMouseover = "this.style.borderColor = '#efefef',this.style.backgroundColor='#EFEFEF'"
onMouseout = "this.style.borderColor = 'silver',this.style.backgroundColor='#FFFFFF'"> 1
</td>
<td id="item2" style="padding: .2em; width: 270px; height: 60px; border: thin solid
silver; background:#FFFFFF"
onMouseover = "this.style.borderColor = '#efefef',this.style.backgroundColor='#EFEFEF'"
onMouseout = "this.style.borderColor = 'silver',this.style.backgroundColor='#FFFFFF'"> 2
</td>
</tr>
<tr>
<td id="item3" style="padding: .2em; width: 270px; height: 60px; border: thin solid
silver; background:#FFFFFF"
onMouseover = "this.style.borderColor = '#efefef',this.style.backgroundColor='#EFEFEF'"
onMouseout = "this.style.borderColor = 'silver',this.style.backgroundColor='#FFFFFF'"> 3
</td>
<td id="item4" style="padding: .2em; width: 270px; height: 60px; border: thin solid
silver; background:#FFFFFF"
onMouseover = "this.style.borderColor = '#efefef',this.style.backgroundColor='#EFEFEF'"
onMouseout = "this.style.borderColor = 'silver',this.style.backgroundColor='#FFFFFF'"> 4
</tr>
<!-- fin:ITEMS -->
</table>
aqui mi duda

onclick = newinfo llamaria esta funcion, pero no se quien fue de las 4 opciones...
Código javascript
:
Ver originalvar maxchars = 100;
var frases = new Array();
frases[0] = 'hola gatito. Este tema habla de este item, mas contenido lorem ipsum san dsfer fdc bdfgdvcxc';
frases[1] = 'hola perrito. Este tema habla de este item, mas contenido lorem ipsum san dsfer fdc bdfgdvcxc';
frases[2] = 'hola pajarito. Este tema habla de este item, mas contenido lorem ipsum san dsfer fdc bdfgdvcxc';
frases[3] = 'hola mundito. Este tema habla de este item, mas contenido lorem ipsum san dsfer fdc bdfgdvcxc';
function newsinfo()
{
alert ('desplegar informacion en '+maxchars)
}
for (i=1; i<5; i++)
{
contenido = frases[i-1];
itemcont = (contenido.length>maxchars) ? contenido.substring(0,maxchars) : contenido;
itemcont += '<br /><div style="text-align:right"><a href="#">leer más >></a></div>'
document.getElementById('item'+i).innerHTML = 'DATE , item'+i+ ': ' + itemcont;
document.getElementById('item'+i).onclick = newsinfo;
}