473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

innerHTML forms et FF

OAM
Hi,

Why this code work with IE and not with FF

1- add an input
2- enter a value
3 -add a second input

With FF, the value is lost, not avec IE !

Thanks

Olivier.

----------

<html>
<head>

<script type="text/javascript">
var indice_sensor=0;
function add_sensor() {
indice_sensor=indice_sensor+1;

if (indice_sensor == 1)
document.getElementById('add_sensor').innerHTML=
indice_sensor+":&nbsp;<input type='text'
name='Sensor_Name["+indice_sensor+"]' id='Sensor_Name"+indice_sensor+"'/><br
/>";
else
document.getElementById('add_sensor').innerHTML=
document.getElementById('add_sensor').innerHTML
+indice_sensor+":&nbsp;<input type='text'
name='Sensor_Name["+indice_sensor+"]' id='Sensor_Name"+indice_sensor+"'/><br
/>";
}
</script>

</head>
<body>

<form>
<div>
<span id='add_sensor'></span>
</div>
</form>
<a href="#" onClick="javascript:add_sensor()">Click</a>

</body>

Sep 23 '06 #1
1 1076
ASM
OAM a écrit :
Hi,

Why this code work with IE and not with FF

1- add an input
2- enter a value
3 -add a second input
<html>
<script type="text/javascript">

var idx=0;

function addInput(idWhere) {
idx ++;
var target = document.getElementById(idWhere);
var txt = document.createTextNode(idx+' : ');
var elt = document.createElement('INPUT');
elt.name = 'Sensor_Name['+idx+']';
elt.id = 'Sensor_Name'+idx;
var br = document.createElement('BR');
target.appendChild(txt);
target.appendChild(elt);
target.appendChild(br);
}
</script>

<button onclick="addInput('ici');">Add input</button>
<p id="ici"></p>
</html>

--
ASM
Sep 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Kyle | last post by:
I am presently making use of documentElement.innerHTML to retrieve page contents for manipulation, but I've noticed that the sting value returned is not identical to the actual page source....
3
by: mtz | last post by:
Hi there, It looks like safari has a problem with innerHTML. I have to change a dropdown depending on a selection in another dropdown. When I change the selection in the first dropdown the...
2
by: Iver Erling Årva | last post by:
I have come across a problem with the onKeyDown event in some of my forms. I'm using onKeyDown in <form> as a standard method to open my help screen system throughout my system, but I have...
24
by: bedhead | last post by:
Why doesn't a SELECT element's innerHTML reflected which option was selected? Works in IE. I need this functionality so that I can retain what choices a user made in a tabbed interface. ...
5
by: syntheticninja | last post by:
I am trying to loop through a form to get all the check boxes that exist on that particular form. My problem is the checkboxes are dynamically added to the page after it has loaded (using the...
8
by: McKirahan | last post by:
Firefox does not reflect selected option via innerHTML How do I get Firefox to reflect selected option values? <html> <head> <title>FFinner.htm</title> <script type="text/javascript">...
1
by: Paul | last post by:
Here is my current code: ------------ <script runat=Server> void Page_Load(object sender, EventArgs e){ if (!IsPostBack){ myDiv.InnerHtml = "Original Content"; } //On Postback, should equal...
9
by: Hallvard B Furuseth | last post by:
Why does the FAQ (Q 4.15) recommend innerHTML when so many here say one should use createElement(), replaceChild() etc? Also, why does the "Alternative DynWrite function" at...
4
by: Dan Michael Heggå | last post by:
Hi, I've working on inplace-editing. My problem is the following: This works in all browsers: myDiv.innerHTML = "<p>...</p>"; but this doesn't work in IE: myDiv.innerHTML =...
2
by: xhe | last post by:
I met a very headache problem in javascript, I think this might be difference between IE and NS / Safari. I have a text area <form> <textarea name='tex1' onkeyup='displayit();'></textarea>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.