# Functions with javascript

**URL:** <https://forum.kirupa.com/t/functions-with-javascript/666250>\
**Category:** programming\
**Created:** [April 15, 2024, 9:01pm UTC](https://forum.kirupa.com/t/functions-with-javascript/666250 "2024-04-15T21:01:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![edhunt198](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@edhunt198](https://forum.kirupa.com/u/edhunt198)\
**Post date:** [April 15, 2024, 9:01pm UTC](https://forum.kirupa.com/t/functions-with-javascript/666250/1 "2024-04-15T21:01:44Z")

</div>

i just bought the javascript absolute begginers guide and whenever i put in alert(“hello!”) it turns pink and just ends up with a blank screen and no popup

thanks for helping

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [April 15, 2024, 9:15pm UTC](https://forum.kirupa.com/t/functions-with-javascript/666250/2 "2024-04-15T21:15:25Z")

</div>

Hi Ed! Welcome to the forums 🙂

Can you please share the full code you have in your document?

Thanks,  
Kirupa

---

<div class="post-metadata">

**Author:** ![edhunt198](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@edhunt198](https://forum.kirupa.com/u/edhunt198)\
**Post date:** [April 15, 2024, 9:16pm UTC](https://forum.kirupa.com/t/functions-with-javascript/666250/3 "2024-04-15T21:16:21Z")

</div>

i just got the book a few days ago this is all i have

```auto
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>hello</title>

    <style>

    </style>
</head>

<body>
    <script>
        function sayHello() {
            alert("hello!");
        }
       
    </script>
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [April 15, 2024, 10:01pm UTC](https://forum.kirupa.com/t/functions-with-javascript/666250/4 "2024-04-15T22:01:46Z")

</div>

You need to call the **sayHello** function to have it run, as shown below. That should do it 🙂

```
<script>
    function sayHello() {
        alert("hello!");
    }
    sayHello();
   
</script>

```

---

<div class="post-metadata">

**Author:** ![edhunt198](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@edhunt198](https://forum.kirupa.com/u/edhunt198)\
**Post date:** [April 15, 2024, 10:07pm UTC](https://forum.kirupa.com/t/functions-with-javascript/666250/5 "2024-04-15T22:07:07Z")

</div>

Thanks A lot you were a great help now I can continue the book!

Thanks again!  
Edhunt198

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [April 16, 2024, 4:34pm UTC](https://forum.kirupa.com/t/functions-with-javascript/666250/6 "2024-04-16T16:34:21Z")

</div>

Glad it worked out 🙂

Feel free to create new topics for any other questions or issues you have, no matter how big or small!
