note 44286 added to function.dom-domelement-setattribute
| From: | php-general at lists dot php dot net | Date: | Tue, 20 Jul 2004 15:18:14 +0000 |
| Subject: | note 44286 added to function.dom-domelement-setattribute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-73694@lists.php.net to get a copy of this message | ||
Note that the setAttribute method will not work with event handlers. Although it will create the
attributes, it will not execute javascript functions unless they are directly embedded inside the
event handler.
ie
<?php
$dom = new DomDocument();
$link = $dom->createElement('a');
//Will Not Work
$link->setAttribute('onclick', 'toggle(\'obj\')');
//Will work
$link->setAttribute('onclick', 'javascript:this.style.color =
\'red\'');
?>
----
Manual Page -- http://www.php.net/manual/en/function.dom-domelement-setattribute.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44286
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44286&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44286&report=yes
Search -- http://master.php.net/manage/user-notes.php