JSFiddle - React, Tailwind, and code Playground
HTML
<div id='menu_1'>
<div class = 'razdel_1'><a href = '#'>Раздел 1</a></div>
<div class = 'razdel_2'><a href = '#'>Раздел 2</a></div>
<div class = 'razdel_3'><a href = '#'>Раздел 3</a></div>
</div>
JavaScript
function d2h(d) { return (+d).toString(16).toUpperCase(); }
function getColor(){
return '#' + d2h(parseInt(Math.random()*16777215 + 1));
}
document.getElementById('menu_1').onmouseover= function(){
document.getElementsByTagName("a")[0].value = checkLength(getColor());
}
function checkLength(str){
var length = str.length;
if(length < 7){
for(var i = length; i < 7; i++)
str += '0';
}
return str;
}