javascript 将值附加到URL

6yoyoihd  于 2023-01-07  发布在  Java
关注(0)|答案(1)|浏览(168)

我有一个脚本内的值,我想将此值附加到URL,我尝试使用window.location,但它不工作

function handleSelect1(elm) {
    
   var elm = document.getElementById('hiddencorporateId').value;
    window.location = window.location.origin + window.location.pathname + "?updateid=" + elm.value;
    // document.write(elm);
}
z9zf31ra

z9zf31ra1#

用于更新location.href

function handleSelect1(elm) {
    
   var elm = document.getElementById('hiddencorporateId').value;
   
  location.href = location.href + "?updateid=" + elm
}

相关问题