PDA

View Full Version : JS & CSS stuffs


tbonem91
12-26-2003, 03:43 PM
Hello,

Here's what I need to do:

I have a select box with several choices. when the choice with value '1' is selected, a block of text below the select box needs to be readable and any other choice crosses it out (line-through).

I have all the code in place working but I cannot figure out how to dynamically change the text-decoration attribute. I've searched myself silly and finally broken down and decided to ask you all :)

My code is below... (ignore the struts stuff)

...

<html:select property="cubeStatusId" size = "1" onchange="changeStatus()">
<html:option value = "1">Occupied</html:option>
<html:option value = "57">Vacant/Active</html:option>
<html:option value = "58">Vacant/Inactive</html:option>
</html:select>

...

<td colspan="2"><html:text property="employeeId" size="40"/></td>

...

<span id="info">Type the 1st letter of the last name above and press 'Search...' or enter their netid</span>

...

<script>
function changeStatus(){
var v = document.all["cubeStatusId"];
if (v.options[v.selectedIndex].value!="1"){
document.all["employeeId"].value="Empty";
document.all["employeeId"].disabled=true;
//here I need to cross out the info
}else{
document.all["employeeId"].disabled=false;
document.all["employeeId"].value="";
//here I need to uncross it
}
}
</script>

...


thanx!

ucm
12-27-2003, 05:28 AM
if (v.options[v.selectedIndex].value!="1"){
document.all["employeeId"].value="Empty";
document.all["employeeId"].disabled=true;
//here I need to cross out the info

document.all["employeeId"].style.textDecoration='line-through';

}else{

tbonem91
12-27-2003, 03:25 PM
gracias!