ZVON > References > DOM2 Reference

createProcessingInstruction (method )

Owning interface and usage:  
Document.createProcessingInstruction(target, data)

Member of these other interfaces:  
none

Description:  
Creates a ProcessingInstruction node given the specified name and data strings.

Parameters:  
DOMString target  -  The target part of the processing instruction.
DOMString data  -  The data for the node.

Returns:  
ProcessingInstruction -  The new ProcessingInstruction object.

Exceptions:  
DOMException INVALID_CHARACTER_ERR
Raised if the specified target contains an illegal character.
DOMException NOT_SUPPORTED_ERR
Raised if this document is an HTML document.


Example:
JavaScript:
  var pi = document.createProcessingInstruction('php', 'echo("another example")');
  var output1 = pi.nodeType;
  var output2 = pi.target;
  var output3 = pi.data;
Output:
desired your browser
output1: 7
output2: php
output3: echo("some example")