# using javascript in html

**URL:** <https://discourse.processing.org/t/using-javascript-in-html/211>\
**Category:** Coding Questions\
**Created:** [May 21, 2018, 4:31pm UTC](https://discourse.processing.org/t/using-javascript-in-html/211 "2018-05-21T16:31:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)\
**Post date:** [May 21, 2018, 4:31pm UTC](https://discourse.processing.org/t/using-javascript-in-html/211/1 "2018-05-21T16:31:05Z")

</div>

So I started using javascript and html to make website and thought it be fun to convert my java games to javascript and place them on my website. I wrote code trying to see my javascript game from the html webpage, but i only see a white screen whenever i pull it up.  
here the html code:

```auto
<!doctype html>

<title>Space Invaders</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> 
<script src = "spaceInvaders.js"></script>

```

here the java script code:

```auto
function setup(){
  createCanvas(400,400);
}

function draw(){
  background(0);
}

```

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 21, 2018, 4:33pm UTC](https://discourse.processing.org/t/using-javascript-in-html/211/2 "2018-05-21T16:33:36Z")

</div>

@ctrembla – This is a forum for Processing / p5.js.

Are you using Processing, and are you trying to write p5.js using the Processing PDE editor? You don’t say anything about how your spaceInvaders.js game was coded, and all I see in your code is JQuery.

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [May 21, 2018, 5:56pm UTC](https://discourse.processing.org/t/using-javascript-in-html/211/3 "2018-05-21T17:56:59Z")

</div>

Like @jeremydouglass said, I don’t see anywhere in your HTML where you include the P5.js library.

Shameless self-promotion: here is a guide on putting together a Hello World program in P5.js:

> **[P5.js Hello World](https://happycoding.io/tutorials/p5js/hello-world)**
>
> Say hello world to P5.js!

---

<div class="post-metadata">

**Author:** ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)\
**Post date:** [May 21, 2018, 6:00pm UTC](https://discourse.processing.org/t/using-javascript-in-html/211/4 "2018-05-21T18:00:57Z")

</div>

I solved it on another chat.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 21, 2018, 6:01pm UTC](https://discourse.processing.org/t/using-javascript-in-html/211/5 "2018-05-21T18:01:27Z")

</div>

@ctrembla – …so, was it a Processing question? Or just JavaScript / JQuery?

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [May 21, 2018, 6:40pm UTC](https://discourse.processing.org/t/using-javascript-in-html/211/6 "2018-05-21T18:40:18Z")

</div>

> [@ctrembla](#):
>
> I solved it on another chat.

I’m glad you got it figured out. Can you also post the answer here so other people with similar problems in the future will be able to learn? Also if you posted to another site please link between crossposts.

---

<div class="post-metadata">

**Author:** ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)\
**Post date:** [May 22, 2018, 2:18am UTC](https://discourse.processing.org/t/using-javascript-in-html/211/7 "2018-05-22T02:18:47Z")

</div>

it was javascript. Thanks for the reply will post soon.  
solved here:

> <https://github.com/CodingTrain/Rainbow-Topics/issues/977#issuecomment-390453751>
