Home > front end >  Beginners turn!!!!! JavaScript part
Beginners turn!!!!! JavaScript part

Time:10-09

The function createRow () {
Var editTable=document. GetElementById (" tbody ");
Var tr=document. The createElement method (" tr ");
Var td0=document. The createElement method (" td ");
Td0. InnerHTML="& lt; Input type='text' maxlength='9' style='border: 0' & gt; ";

Var checkbox=document. The createElement method (" input ");
The checkbox. Type="checkbox";
The checkbox. Name="checkRow";
Var td1=document. The createElement method (" td ");
Td1. InnerHTML="& lt; Input type='text' maxlength='7' style='border: 0' & gt; ";

Var td2=document. The createElement method (" td ");
Td2. InnerHTML="& lt; Span id='sh/& gt; Not review ";
Var td3=document. The createElement method (" td ");
Td3. InnerHTML="& lt; Input type="button" value='https://bbs.csdn.net/topics/review' onclick='shenhe ()' & gt; & Emsp;
Var td4=document. The createElement method (" td ");
Td4. The appendChild (checkbox);
The tr. The appendChild (td0);
The tr. The appendChild (td1);
The tr. The appendChild (td2);
The tr. The appendChild (td3);
The tr. The appendChild (td4);
EditTable. The appendChild (tr);
}


The function shenhe ()
{
Alert (" content: 1111111111111 ")
Var td2=document. GetElementById (" sh ");
Td2. InnerHTML="approved";

}

The above for JavaScript code
Problem is: click on the audit after only the first state never to have been audit, the other is invalid,




CodePudding user response:

Var td2=document. The createElement method (" td ");
Td2. InnerHTML="& lt; Span class='sh/& gt; Not review ";
Var td3=document. The createElement method (" td ");
Td3. InnerHTML="& lt; Input type="button" value='https://bbs.csdn.net/topics/review' onclick='shenhe (this)' & gt; & Emsp;
Var td4=document. The createElement method (" td ");
Td4. The appendChild (checkbox);
The tr. The appendChild (td0);
The tr. The appendChild (td1);
The tr. The appendChild (td2);
The tr. The appendChild (td3);
The tr. The appendChild (td4);
EditTable. The appendChild (tr);
}


The function shenhe (t)
{
Alert (" content: 1111111111111 ")
Var td2=t.p arentNode. ParentNode. QuerySelector (" sh ");
Td2. InnerHTML="approved";

}

CodePudding user response:

Thank you upstairs bosses help!!!!!
  • Related