создание и продвижение сайта (вбиваю в ТОП-10, как гвозди)Настройка и сопровождение платной рекламы яндекс.директ

PHP. Руководство по PHP. 2005

DOMElement->setAttribute()

HREF="function.dom-domelement-removeattributens.html"> HREF="function.dom-domelement-setattributenode.html"> Пред.

След.

DOMElement->setAttribute()

(no version information, might be only in CVS)DOMElement->setAttribute() -- Adds new attribute

Описание

class DOMElement {


bool setAttribute (string name, string value)


}

Sets an attribute with name name to the given value. If the attribute does not exist, it will be created.

Список параметров

name

The name of the attribute.

value

The value of the attribute.

Возвращаемые значения

Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.

Исключения

DOM_NO_MODIFICATION_ALLOWED_ERR

Raised if the node is readonly.

Примеры

Пример 1. Setting an attribute

<?php

$doc = new DOMDocument("1.0");

$node = $doc->createElement("para");

$newnode = $doc->appendChild($node);

$newnode->setAttribute("align", "left");

?>

Смотрите также

DOMElement->hasAttribute()
DOMElement->getAttribute()
DOMElement->removeAttribute()

Пред.

Начало

След.

DOMElement->removeAttributeNS()

Уровень выше

DOMElement->setAttributeNode()

Отвечу на любые вопросы. С уважением, Дмитрий Владимирович.

Ваше письмо×
Free Web Hosting