KikePeris KikePeris - 4 months ago 25
HTML Question

Simple script not working on my html code for my site

I am learning HTML and Javascript, but it seems I did something wrong and I can't figure it out, why won't my script work? It is supposed to change the size of the image when you hover over with the mouse. I'm just investigating to learn how to do stuff.

<!doctype html>
<title> Kikito's Sprites </title>
<body style="background-color:#ffc299">
<h1 style="color:white"> Kikito Loco Sprite Showcaserino </h1>

<img onmouseover="descriptiveTextImg(this)" onmouseout="normalImg(this)" src="monigoteTransparencia.png" alt="Amicable Anthony" style="position:absolute;top:100px;left:-50px;width:300px;height:300px;">
<img src="ballinBob.png" alt="Ballin Bob" style="position:absolute;top:90px;left:130px;width:300px;height:300px;">

<img src="severedArm.png" alt="just some pixel gore" style= "position:absolute;top:350px;left:-40px;width:300px;height:300px;">
<img src="shinySkin.png" alt="Shiny Skin" style="position:absolute;top:350px;left:200px;width:300px;height:300px;">
<img src="bigBall.png" alt="a cannonball" style= "position:absolute;top:640px;left:-40px;width:300px;height:300px;">

function descriptiveTextImg(x)
{ = 400px; = 400px;

function normalImg(x)
{ = 300px; = 300px;




Change all occurrences of 300px to '300px', etc.

style.width and style.height expects string values. 300px is not valid javascript code. If you need to use number, i.e. if you are using variables, you'll need to concatenate this into a string: = someIntWidth + 'px';