在 php 页面中,我有 20 个文本框。我想使用 javascript 制作一个按钮,当用户单击它时,其余 19 个文本框将获取第一个文本框的文本。我已经做了类似的事情,但它不起作用......有什么想法吗?
function Throw_PhotoStuff(){
var pcount=1;
while(pcount<20;){
document.getElementById('photo_'+pcount).value = document.getElementById('photo_1').value; pcount++;
}
}
最佳答案
从 while 循环中删除分号,例如:
while(pcount<20;){ //will show SyntaxError: missing ) after condition
至
while(pcount<20){
关于JavaScript while 循环失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18975387/