|
|
|
Forum Guru
      
участник
Last Login: 30.11.2006 16:49
Сообщ.: 65,
Visits: 694
|
|
| Уважаемые! Есть вот такой код: <html> <head> </head> <script language="JavaScript"> function textareaclick() { var element_ = null; var i = 0; element_ = window.event.srcElement; document.getElementById('txt').childNodes.item(0).nodeValue = '\r********* ' + element_.tagName + ' begin *********'; for (i = 0; i < element_.attributes.length; i++) if (element_.attributes.item(i).specified) document.getElementById('txt').childNodes.item(0).nodeValue = document.getElementById('txt').childNodes.item(0).nodeValue + '\r' + element_.attributes.item(i).nodeType + ': ' + element_.attributes.item(i).name + ' = ' + element_.attributes.item(i).value; document.getElementById('txt').childNodes.item(0).nodeValue = document.getElementById('txt').childNodes.item(0).nodeValue + '\r********* ' + element_.tagName + ' end *********'; } </script> <body> <textarea id="txt" cols=50 rows=20 style="cursor:hand;" onclick="textareaclick();">area</textarea> </body> </html>
Так вот в результате получаем style = null, а надо бы что-то вроде style = cursor:hand Как быть? Спасибо.
|
|
|
|
|
Forum Member
      
участник
Last Login: 11.09.2006 14:48
Сообщ.: 37,
Visits: 376
|
|
у атрибута style нет свойства value
function textareaclick()
{
var element_ = null;
var i = 0;
element_ = window.event.srcElement;
document.getElementById('txt').childNodes.item(0).nodeValue = '\r********* '
+ element_.tagName
+ ' begin *********';
for (i = 0; i < element_.attributes.length; i++)
{
if (element_.attributes.item(i).specified)
{
if (element_.attributes.item(i).name == 'style')
{
document.getElementById('txt').childNodes.item(0).nodeValue += '\r'
+ element_.attributes.item(i).nodeType + ': '
+ element_.attributes.item(i).name + ' = '
+element_.style.cssText;
}
else
{
document.getElementById('txt').childNodes.item(0).nodeValue += '\r'
+ element_.attributes.item(i).nodeType + ': '
+ element_.attributes.item(i).name + ' = '
+ element_.attributes.item(i).value;
}
}
}
document.getElementById('txt').childNodes.item(0).nodeValue =
document.getElementById('txt').childNodes.item(0).nodeValue
+ '\r********* '
+ element_.tagName
+ ' end *********';
}
|
|
|
|