Loan - Flights - Car Credit - Personal Injury Lawyer Los Angeles - Gabriel Garcia Marquez

PDA

View Full Version : Change text on document onclick


strNoob
Apr 8th 2005, 11:02 am
I want to allow users to change the font, color, size of text etc... using a form and cookies.

That part is easy. But instead of just using a basic text form.
<select>
<option>red<option>
<option>green</option>
<option>blue</option>
<option>yellow</option>
etc...

I wanted to use images in the form that would be clicked then submitted...

I was thinking something like:
<img src='red.gif' onclick='someScript(red)'>
<img src='green.gif' onclick='someScript(green)'>
<img src='blue.gif' onclick='someScript(blue)'>

That would change the hidden form value on the fly like:

<input type='hidden' name='font_color' value='+newcolor+'>

I've found many examples that changed colors,font size,etc...

But nothing that could change the value like what I want...

is it possible?

J.D.
Apr 9th 2005, 1:50 pm
You can change the value of an input element this way:

<input type="text" id="i1" value="initial value">
<some-element onclick="document.getElementById('i1').value = Math.random()">J.D.