我一直在尝试使用 javascript 下载 exe 文件,我之前使用单选按钮做过,但现在我不知道我应该如何下载。场景是有 3 个复选框 admin,security,security1,我应该检查是否在单击下载按钮后选择了哪个复选框组合,需要下载不同的 zip 文件。
<button onclick="
if(!this.form.admin.checked&&!this.form.security.checked&&!this.form.security1.checked)
{
document.getElementById('errfn').innerHTML='Make atleast one selection';
}
else if (this.form.admin.checked&&this.form.security.checked&&this.form.security1.checked == 1)
{
alert('security32 and admin and security64');
}
else if (this.form.security.checked&&this.form.security1.checked == 1)
{
alert('security64 and security32');
}
else if (this.form.admin.checked&&this.form.security.checked == 1)
{
alert('security32 and admin');
}
else if (this.form.admin.checked&&this.form.security1.checked == 1)
{
alert('security64 and admin');
}
else if (this.form.admin.checked == 1)
{
alert('admin is checked');
}
else if (this.form.security.checked == 1)
{
alert('security 32 is checked');
}
else if (this.form.security1.checked == 1)
{
alert('security64 is checked');
}
return false;
">Submit</button>
我已经用 location.href="images/download.exe" 替换了警报;检查它是否没有被下载
适用于单选按钮的代码是
<input value="1" type="radio" id="1" name="formselector" onclick="displayForm(this)">
function displayForm(c)
{
var radios = document.getElementById("1").value;
location.href="images/WismanWeb 32 bit.exe";
}