how do I get the css and the html into the function?

HTML Code:
<html>
<head>
<script type="text/javascript">
function myFunction()
{
return ("Hello world!");
}
</script>
</head>
<body>
<div style="float:right;">
<script type="text/javascript">
document.write(myFunction())
</script>
</div>
</body>
</html>