"use strict";
function hexidecimal() {
	var num = document.getElementsByName('number')[0].value;
	var hex = num.toString(16);
<form id="form">
<input type="text" name="number" />
<input type="button" value="Hex" onClick="hexidecimal();" />

Above is the current code I have, I expect it to output the contents of whatever is held in the number input box as a hexidecimal number, instead it outputs whatever number is put into the box as base 1. Can anyone shed some light on what I have done wrong please?