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

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>
Jump to Post

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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.