Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

I get a parser error "The ID 'txt1' is already used by another control"

 

<HTML>

<HEAD>

<title>TestInnerHTML</title>

<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">

<meta name="CODE_LANGUAGE" Content="C#">

<meta name="vs_defaultClientScript" content="JavaScript">

<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

<script language="javascript">

function a(){

a = tab1.insertRow()

cell = a.insertCell()

strinner = '<input type=text id="txt1" name="txt1" value="sdfs2333dfsdf" runat=server >'

cell.innerHTML = strinner;

}

function test(){

//alert(document.forms[0].length)

for (k=0;k<2 ;k++){

alert(k)

alert(document.forms[0].txt1[k].value)

}

//alert(document.TestInnerHTML._ctl0.value)

}

</script>

</HEAD>

<body MS_POSITIONING="GridLayout">

<form id="TestInnerHTML" method="post">

<table id="tab1" runat="server">

<tr id="trinneradd">

<td id="tdinneradd">

<input type="text" id="txt1" name="txt1" value="sdfsdfd" runat=server>

</td>

</tr>

</table>

<input type="button" name="btnClk" onclick="a()">

<input type="button" name="btnClkFunc" onclick="test()">

<input type=submit >

</form>

</body>

</HTML>

 

 

Ahmed

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...