How to write a simple HTML page with JavaScript

2 Answers

0 votes
<!DOCTYPE html>
<html>

<head>


<script>

document.write("<title>The page title</title>");
document.write("<body>");
document.write("<p>p tag 1</p>");
document.write("<p>p tag 2</p>");
document.write('<button onclick="Test()">Click Here</button>');
document.write("<p>p tag 3</p>");
document.write('<a href="#">a tag</a>');
document.write('<ul>');
document.write('<li>li tag</li>');
document.write('</ul>');
document.write('</body>');

function Test()
{
    alert('It Works!')
}

/*
run:


*/

</script>

</script>
</head>

</html>

 



answered Jul 6, 2015 by avibootz
0 votes
<!DOCTYPE html>
<html>

<head></head>

<body>
<script>

document.write("<p>p tag 1</p>");
document.write("<p>p tag 2</p>");
document.write('<button onclick="Test()">Click Here</button>');
document.write("<p>p tag 3</p>");
document.write('<a href="#">a tag</a>');
document.write('<ul>');
document.write('<li>li tag</li>');
document.write('</ul>');

function Test()
{
    alert('It Works!')
}

/*
run:


*/

</script>
</body>

</html>

 



answered Jul 6, 2015 by avibootz
...