Home > front end >  Online ~ ~ ~ such as strange, why am I in the js form name change is not?
Online ~ ~ ~ such as strange, why am I in the js form name change is not?

Time:02-09

 
<script type="text/javascript">
Window. The onl oad=function () {
Var inputs=document. QuerySelectorAll (" input ^=xinghao_3_ [id], input ^=b [id] ");
for(i=0; iInputs [I] onblur=function () {
Var n=this. Id. Slice (1);
Var add1=document. GetElementById (" xinghao_3_ "+ n). The value;
Var add2=document. GetElementById (" b "+ n). The value;
Document. The getElementById (" xinghao_5_ "+ n). Value=https://bbs.csdn.net/topics/add1 add2 * * 1 * 1;
}
}
}
</script>

I am a b1 or b2) form of id, and so on, can normal summation is the js?
But now I need to change the id to xinghao_x_x type can not? Exactly what is going wrong?
O master,,,




CodePudding user response:

I directly to:

<script type="text/javascript">
Window. The onl oad=function () {
Var inputs=document. QuerySelectorAll (" input ^=xinghao_3_ [id], input ^=xinghao_4_ [id] ");
for(i=0; iInputs [I] onblur=function () {
Var n=this. Id. Slice (1);
Var add1=document. GetElementById (" xinghao_3_ "+ n). The value;
Var add2=document. GetElementById (" xinghao_4_ "+ n). The value;
Document. The getElementById (" xinghao_5_ "+ n). Value=https://bbs.csdn.net/topics/add1 add2 * * 1 * 1;
}
}
}
</script>


I change the form id for xinghao_4_x directly based on the above js, it's not? Such a strange oh? And then directly to other b, unity is no problem??

CodePudding user response:

Var n=this. Id. Slice (1);
Change
Var n=this. Id. Slice (1);

CodePudding user response:

^=xinghao_3_ input [id], matching id begin with xinghao_3_ input, is not match your _5, of course I couldn't find it
  • Related