javascript element search

Hi,
 I am using this javascirpt fuction but my page contains around 5000 controls as we are using regulare expression its taking time to load the page some times it stop processing. Is there any other way to do this with out regexpression.

<html>
<head>
<script language="javascript">
function fill()
{
  var re = /^txtJpn_(\d+)/;
  var match;

  for (var i = 0; i < document.forms[0].elements.length; i++)
  {
     match = re.exec(document.forms[0].elements[i].name);
     if (match) {
         document.getElementById("txtOthers_" + match[1]).value = document.forms[0].elements[i].value;
     }
  }
}
</script>
</head>
<body>
<form>
<input type="text" name="txtJpn_0" >
<input type="text" name="txtOthers_0">
<input type="text" name="txtJpn_1">
<input type="text" name="txtOthers_1">
<input type="text" name="txtJpn_2">
<input type="text" name="txtOthers_2">
<input type="text" name="txtJpn_3">
<input type="text" name="txtOthers_3">
<input type="text" name="txtJpn_4">
<input type="text" name="txtOthers_4">
<input type="text" name="txtJpn_5">
<input type="text" name="txtOthers_5">
<input type="text" name="txtJpn_6">
<input type="text" name="txtOthers_6">
<input type="button" onclick="fill();" value="Fill">
</form>
</body>
</html>
sateeshkumarjAsked:
Who is Participating?
 
ZvonkoSystems architectCommented:
Here an example:

<html>
<head>
<title>Zvonko &#42;</title>
<script language="javascript">
function fill(theBtn){
  var theForm = theBtn.form;
  for(var i=0;theForm["txtJpn_"+i];i++){
    theForm["txtOthers_"+i].value = theForm["txtJpn_"+i].value;
  }
}
</script>
</head>
<body>
<form>
<input type="text" name="txtJpn_0" >
<input type="text" name="txtOthers_0"><br>
<input type="text" name="txtJpn_1">
<input type="text" name="txtOthers_1"><br>
<input type="text" name="txtJpn_2">
<input type="text" name="txtOthers_2"><br>
<input type="text" name="txtJpn_3">
<input type="text" name="txtOthers_3"><br>
<input type="text" name="txtJpn_4">
<input type="text" name="txtOthers_4"><br>
<input type="text" name="txtJpn_5">
<input type="text" name="txtOthers_5"><br>
<input type="text" name="txtJpn_6">
<input type="text" name="txtOthers_6"><br>
<input type="button" onclick="fill(this);" value="Fill">
</form>
</body>
</html>

0
 
sateeshkumarjAuthor Commented:
this question is a continuation of this below question.
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21823189.html
0
 
ZvonkoSystems architectCommented:
Please explain why you graded my support with the grade B.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.