said_fox
08-26-2003, 05:59 PM
As we know if we have an element has the name, for example, fff and this element may be a form element like select. we can remove it dynamically as follows,
arr = document.getElementsByName("fff");
arr[0].innerHTML="";
A typical Example for this is demonstrated in the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script>
function remove_it(){
arr = document.getElementsByName("fff");
arr[0].innerHTML="";
}
</script>
</head>
<body>
<form>
<select name="fff">
<option>op1
<option>op2
<option>op3
</select>
<input type="checkbox" onClick="remove_it()">
</form>
Ok till this point every thing goes well. The problem starts when I want to re add or redisplay the removed element.
I tried to store the value of arr[0].innerHTML in a global variable, var x, but when I assign arr[0].innerHTML = x.
nothing is happened. ofcourse I make some kind of modification on the remove_it() function.
Do any one has some advice or idea?:confused:
arr = document.getElementsByName("fff");
arr[0].innerHTML="";
A typical Example for this is demonstrated in the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script>
function remove_it(){
arr = document.getElementsByName("fff");
arr[0].innerHTML="";
}
</script>
</head>
<body>
<form>
<select name="fff">
<option>op1
<option>op2
<option>op3
</select>
<input type="checkbox" onClick="remove_it()">
</form>
Ok till this point every thing goes well. The problem starts when I want to re add or redisplay the removed element.
I tried to store the value of arr[0].innerHTML in a global variable, var x, but when I assign arr[0].innerHTML = x.
nothing is happened. ofcourse I make some kind of modification on the remove_it() function.
Do any one has some advice or idea?:confused: