View Full Version : please help

09-12-2011, 07:39 PM
Here is some code that I am working with

<INPUT type="text" name=a1c />

document.myquiz.a1c.value = "CORRECT!";

How can I replace the string "Correct!" with an image???
Something like this:
document.myquiz.a1c.value = "<img src ...... />;

Thank you

09-12-2011, 07:52 PM
Edit: facepalm

09-12-2011, 08:06 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="daveyerwin">
<script type="text/javascript">
function addBkGrnd(){
<style type="text/css">

<form name="myquiz" action=""><p>
<input type="text" name="a1c">
<input type="button" onclick="addBkGrnd();">

09-12-2011, 09:04 PM
Thank you. Now what if I wanted to add some text after the image. How would I do that? Thanks.

09-12-2011, 09:50 PM
Thank you. Now what if I wanted to add some text after the image. How would I do that? Thanks.

The same way youadded it before ...
document.myquiz.a1c.value = "CORRECT!";

depending on exactly your image
it will go on top of image
with a added spaces and the
right image and a no-repeat css
it can be before or after image

Old Pedant
09-12-2011, 09:57 PM
You could also simply do

<form name="myquiz" action="">
<div id="a1c" style="visibility: hidden;">
<img src="OhGoody.jpg" style="float: left;">CONGRATULATIONS!
<input type="button"

09-13-2011, 04:45 PM
Thank you. One other question. How can I make the input box multiline, the text does not wrap? Any idea? thank you

<INPUT type="text" style="BORDER-LEFT-COLOR: #ffffff; BORDER-BOTTOM-COLOR: #ffffff; COLOR: #808080; BORDER-TOP-STYLE: solid; BORDER-TOP-COLOR: #ffffff; BORDER-RIGHT-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-COLOR: #ffffff; BORDER-BOTTOM-STYLE: solid; color:red; background-repeat:no-repeat; font-size:14px; width:100%;" name=a1c />

09-13-2011, 04:47 PM
Use a textarea element rather than an input element and the text wrapping will be what you expect.

09-13-2011, 05:01 PM
Thank you !!!