JS bug Log Uncaught TypeError: Cannot read property ‘previoustSibling‘ of null

The program code is:

 <!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Visit the Dangdang shopping cart page node</title>
    <link type="text/css" rel="stylesheet" href="css/cartStyle.css" />
</head>
<body>

<div class="content">
    <div class="logo">
        <img src="images/dd_logo.jpg"><span onclick="close_plan();">close</span>
    </div>
    <div class="cartList" id="cartList">
        <ul>
            <li>¥<input type="text" name="price" value="21.90"></li>
            <li><input type="button" name="minus" value="-" onclick="minus(0);"><input type="text" name="amount" value="1"><input type="button" name="plus" value="+" onclick="plus(0);"></li>
            <li id="price0">¥21.90</li>
            <li><p  onclick="collection();">add</p><p onclick="del();">del</p></li>
        </ul>
        <ul>
            <li>¥<input type="text" name="price" value="24.00"></li>
            <li><input type="button" name="minus" value="-" onclick="minus(1);"><input type="text" name="amount" value="1"><input type="button" name="plus" value="+" onclick="plus(1);"></li>
            <li id="price1">¥24.00</li>
            <li><p  onclick="collection();">add</p><p onclick="del();">del</p></li>
        </ul>
        <ol>
            <li id="totalPrice">&nbsp;</li>
            <li><span onclick="accounts()">payout</span></li>
        </ol>
    </div>
    <div id="money"></div>
</div>
<script type="text/javascript" src="js/shopping.js">


</script>
<script type="text/javascript">
	function accounts(){
	     var num1=document.getElementById("cartList").firstChild.lastChild.previoustSibling.innerHTML;
		 var num2=document.getElementById("cartList").firstChild.nextSibling.lastChild.previousSibling.innerHTML;
		 var num3=document.getElementById("totalPrice").innerHTML;
		 var num4="Information about your current purchase is as follows:<br/>White Rock:White says: "+num1+"<br/>Island Bookstore: "+num2+"<br/>Total items:"+num3;
		 document.getElementById("money").innerHTML=num4;
	    }
</script>
</body>
</html>

Display error:

Uncaught TypeError: Cannot read property 'previoustSibling' of null
    at accounts (shopping.html:39)
    at HTMLSpanElement.onclick (shopping.html:29)

Error reason: unable to read space

Solution:
add element to the get node in function accounts()

The correct function code is:

function accounts(){
	     var num1=document.getElementById("cartList").firstElementChild.lastElementChild.previousElementSibling.innerHTML;
		 var num2=document.getElementById("cartList").firstElementChild.nextElementSibling.lastElementChild.previousElementSibling.innerHTML;
		 var num3=document.getElementById("totalPrice").innerHTML;
		 var num4="Information about your current purchase is as follows:<br/>White Rock:White says: "+num1+"<br/>Island Bookstore: "+num2+"<br/>Total items:"+num3;
		 document.getElementById("money").innerHTML=num4;
	    }

Read More: