/ Published in: JavaScript

Taken online
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function decimalToHex(d, padding) { var hex = Number(d).toString(16); padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding; while (hex.length < padding) { hex = "0" + hex; } return hex; }
Comments
