Problem with code I can't figure out
<!DOCTYPE html>
<head><title>Worldz!</title><style type="text/css">
button{
border: 1px #000099 solid;
background-color: blue;
width: 98%;
height: 50px;
}
h1{
text-align: center;
}
body{
background-color: grey;
background-image: none;
}
p{
color: #000;
font: arial;
align:center;
}
#plan{
background-color: #3399FF;
font: helvetica;
border: 2px black solid;
width: 50%;
margin: 15%;
text-align: center;
}
pid{
color: #000;
font: arial;
}
</style>
<script type="text/javascript">
function update(){
bgcolor = document.getElementByID("bgcolor")
bgimg = document.getElementByID("bgimg")
pcolor = document.getElementByID("pcolor")
pfont = document.getElementByID("pfont")
par = document.getElementByID("par")
parea = document.getElementById('pid')
document.style.background = bgcolor;
document.style.backgroundImage = bgimg;
document.parea.style.color=pcolor;
document.parea.style.font=pfont;
document.parea.innerHTML = par;
}
</script></head>
<body>
<div id="plan">
<h1>Worldz</h1>
<form action="javascript:update()" method="POST">
<p>background color: <input type="text" id="bgcolor" size="10"></br>
background image: <input type="text" id="bgimg" size="10"></br>
paragraph color: <input type="text" id="pcolor" size="10"></br>
paragraph font:<select id ="pfont"><option id="arial">arial</option><option id="comic sans ms">comic sans ms</option>
<option id="courier">courier</option><option id="georgia">georgia</option>
<option id="helvetica">helvetica</option><option anme="impact">impact</option></select><br>
paragraph:</br>
<textarea cols = "30" rows="5" id="par">Hello World</textarea><br><br>
<button>update</button></p>
</form>
</div>
<p id="pid">Your text will appear here!</p>
</body>
</html>Offline
It looks fine to me.
Offline
scratcher7_13 wrote:
It looks fine to me.
Do you know what its supposed to do? It changes the css and such of the page.
Offline
ProgrammingFreak wrote:
scratcher7_13 wrote:
It looks fine to me.
Do you know what its supposed to do? It changes the css and such of the page.
Yes, but I don't see a problem with the code.
Offline
scratcher7_13 wrote:
ProgrammingFreak wrote:
scratcher7_13 wrote:
It looks fine to me.
Do you know what its supposed to do? It changes the css and such of the page.
Yes, but I don't see a problem with the code.
Could you try it out?
Offline
Offline
I think the "d" should be lowercase at the end of "document.getElementById", and you need to do "document.getElementById("id").value"
Offline
TheSuccessor wrote:
I think the "d" should be lowercase at the end of "document.getElementById", and you need to do "document.getElementById("id").value"
HTML isn't case sensitive.
Offline