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

<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>

Recommended Answers

All 2 Replies

I think here is your answer..

<html>

      <head>

      <script type="text/javascript">

      function myFunction()

      {

      return ("<h1 style='color:red;background-color:gray'>Hello world!</h1>");

      }

      </script>

      </head>

      <body>
        <div style="float:right;">
        <script type="text/javascript">

      document.write(myFunction())

      </script>

      </div>
        </body>

  </html>

That certainly works. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.