使用JavaScript的window.location.search获取当前URL中的查询字符串参数。
使用正则表达式或其他方法解析查询字符串并从中提取数据。
将提取到的数据传递给要显示参数的div元素。
以下是一个示例代码:
HTML:
JavaScript:
var urlParams = window.location.search; var regex = /?&=([^]*)/g; var params = {}; var match;
while ((match = regex.exec(urlParams)) !== null) { params[decodeURIComponent(match[1])] = decodeURIComponent(match[2]); }
document.getElementById("params").textContent = JSON.stringify(params);