'nodeName' Example : nodeName « Node Operation « JavaScript DHTML

'nodeName' Example

<script language="JavaScript">
function function1() {
   var m = document.getElementById("myNodeOne").nextSibling; m ? alert("Yes") : alert("No");
function function2() {
function function3() {
function function4() {
function function5() {
   var m = document.getElementById("myNodeOne").previousSibling;m ? alert("Yes") : alert("No");
<p>This PARAGRAPH has two nodes, 
    <b id="myNodeOne">Node One</b>, and 
    <b id="myNodeTwo">Node Two</b>.
<button onclick="function1();">Node One has a Next Sibling</button>
<button onclick="function5();">Node One has a Previous Sibling</button>
<button onclick="function2();">Node One Name</button>
<button onclick="function3();">Node One Type</button>
<button onclick="function4();">Node One Value</button>


Related examples in the same category

1.Get node name