Re: Re: Using DOM object, how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ken Tozier wrote:
I don't see any obvious DOM method for including scripts or css links like "<script language='text/javascript' src='bobo.js'>". Do you have to put them in some other type of node like a processing instruction or a comment?

<?php
$dom = new DOMDocument('1.0', 'UTF-8');

$script = $dom->createElement('script');
$script->setAttribute('type', 'text/javascript');
$script->setAttribute('src', 'bobo.js');

$dom->appendChild($script);
?>

Similarly for a link or style element for CSS...

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux