javascript 获取GET方法的参数
2009-07-24 05:26 闫妍 阅读(149) 评论(0) 编辑 收藏 举报<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript"> url = location.search.substr(1); if (url.length > 0) { ar = url.split(/[&=]/); for (i = 0; i < ar.length; i += 2) { alert("参数:" + ar[i] + ":" + ar[i + 1] + "<br>"); } } </script> </head> <body> <a href='?a=你好&room=awe'>test</a> </body> </html>