我有这个表单,Powerrange 字段用于创建 URL,但所需的值与输入的值不同!所以我们需要预定义它们。
<form id="form">
<input type="text" id="powerrange"><br><br>
<input type="radio" name="location" value="store" checked/><label>America</label><br>
<input type="radio" name="location" value="store.au"/><label>Australia and Oceania</label><br>
<input type="radio" name="location" value="store.au"/><label>Africa</label><br>
<input type="radio" name="location" value="store.au"/><label>Asia</label><br>
<input type="radio" name="location" value="store"/><label>Europe</label><br><br>
好的,这就是我到目前为止所拥有的:
function goToPage(){
var location = $('input[name=location]:checked').val();
var idConversions = {"100":14,"101":5000}
$('#powerrange').keyup(function(){
var correctId = idConversions[$(this).val()];
});
window.location.href = "http://"+location+".domain.com/catalog.aspx?section="+correctId+"";
}