devi metterlo in un tag <script> nell'<head>


oppure lo attacchi al body, cosi':

<body onload="merlino()">