In order to get a handle on the text field from client side Javascript you have to know the XPages generated client id. So do this instead to calculate the id inside your CSJS:
<xp:this.script><![CDATA[
var inputvalue = document.getElementById("#{id:InputTextBox5}").value;
alert("inputvalue = " + inputvalue);
dojo.cookie("InputTextBox5", inputvalue, { expires: 1 });
]]></xp:this.script>