15 Paź 2009

Dynamiczne dodanie markera span

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
  <title> New Document </title>
  <script src="debug_js.js" type="text/javascript"></script>
  <script language="JavaScript">
  <!--
 function getE(id) {
  return document.getElementById(id);
 }

 function test() {
  deb_write(deb_prop(getE('tests'),true));
 }

function test2() {
      var div = document.createElement("span");
      div.style.font = '12px Arial, Verdana, Tahoma';
      div.style.position = "absolute";
   div.style.background = '#fefefe';
     div.style.padding = '2px';
   div.id = "s1";
   div.innerHTML = 'Warszawa, Warszawa, Warszawa, Warszawa';
   var d2 = getE('tests2');
      d2.appendChild(div);

deb_write(deb_prop(getE('s1'),true));
 }

 //-->
  </script>
 </head>

<body>
  <div id="tests">Polska Warszawa Polska Warszawa</div>
  <div id="tests2"></div>

  <input type="button" value="Test" onclick="test()">
  <input type="button" value="Test2" onclick="test2()">
 </body>
</html>
6 Paź 2008

Utworzenie najprostszego dokumentu XML

$docs = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
$pages = $docs->appendChild(new DOMElement('pages'));
$element_page = $pages->appendChild(new DOMElement('page'));
$element_page->setAttribute("id", "123456");
$element_name = $docs->createElement('link', 'link numer 123456');
$element_page->appendChild($element_name);
$element_CDATA = $docs->createCDATASection('http://kody.wig.pl/');
$element_url = $element_page->appendChild(new DOMElement('url'));
$element_url->appendChild($element_CDATA);
$xmldata = $docs->saveXML();
echo $xmldata;