Blogger Information
Blog 9
fans 0
comment 0
visits 8867
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
JS函数传递参数 ERROR:"Script error."
廖磊的博客
Original
775 people have browsed it

问题重现:

for(j = 0,len=transfer_list.length; j < len; j++) {
   arguments = transfer_list[j].seatID;
   transfer('+arguments+');
}

function transfer(arguments) {
   console.log(arguments);
}

报错:

VM3015:1 Uncaught ReferenceError: XXL500 is not defined

    at <anonymous>:1:43

ERROR:"Script error."


解决:JS传递参数需要加引号

for(j = 0,len=transfer_list.length; j < len; j++) {
   arguments = transfer_list[j].seatID;
   transfer(\"'+arguments+'\");
}

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post