Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMUZ140877 Nokuthula Mahlangu
6,149 Pointsadd a code inside the <script> tag with the words "Welcome to my site" onto the web page
java script
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
</body>
<script>
<alert:"Welcome to my site">
</script>
</html>
9 Answers
Pedro Sousa
Python Development Techdegree Student 18,546 PointsHi,
In the preceding video, there are 2 methods shown:
- alert
- document.write
I think you're trying to use the alert (but note that you're using a wrong syntax) but what you need to do is just a simple document.write.
This should do it for you:
<script>
document.write("Welcome to my site")
</script>
Greg Kaleka
39,021 PointsGood answer Pedro! I fixed a small typo in your code for you :)
theemwiz
4,641 PointsI am writing this code document.ready("Welcome to my site");
But, still it is not passing the test. What I am doing wrong?
Nurul Ahsan
2,039 Pointsdocument.write("Welcome to my site");
MUZ140877 Nokuthula Mahlangu
6,149 Points<script> document.write("Welcome to my site") </script>
theemwiz
4,641 PointsLol, ignore my comment. I got it fixed. I wrote ready instead of write.
Trevor Mudzimu
7,574 Pointsdocument.write("Welcome to my site");
August Oliver
5,934 Pointsdocument.write("Welcome to my site");
Heba Hendy
7,786 Points<script> document.write("Welcome to my site") </script>
Amyah Aboytes
2,234 Pointsi tried this and all it said wasSyntaxError: Parse error. please get me through this.
Nurul Ahsan
2,039 PointsNurul Ahsan
2,039 PointsSame problem: i have wrote: <script> document.write("<h1>Welcome to JavaScript basic</h1>"); </script>