私のサイト: alainbruno.nl/form.html では、フォーム "Race" とスライダー "Age" が表示されます。この機能を使用すると、スライダーの年齢の最小値と最大値が正しく変更されるのは、別のレースを選択する前に最初にスライダーを使用したときだけです。何をすべきか?
コードがコードとして表示されていない場合は申し訳ありません。携帯電話からこれを書いていますが、追加の指示はありません。
<!DOCTYPE html>
<html lang = "en">
<head>
<title>Character Creation</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function(){
//Range
var slider = $("#slider"), val = slider.val(), output = $("#output");
output.html(val);
slider.on("change", function(){
output.html($(this).val());
$('#Race').change(function () {
if (this.value == "faela") {
$('#slider').prop({
'min': 8,
'max': 52
});
}
if (this.value == "human") {
$('#slider').prop({
'min': 14,
'max': 76
});
}
if (this.value == "domovoi") {
$('#slider').prop({
'min': 26,
'max': 254
});
}
if (this.value == "arcon") {
$('#slider').prop({
'min': 11,
'max': 91
});
}
if (this.value == "tsaaran") {
$('#slider').prop({
'min': 2,
'max': 28
});
}
$('#slider').val('max' / 2);
output.html('Slide');
});
});
});
</script>
<body>
<h1>Form</h1>
<form>
<fieldset>
<legend>Appearance</legend>
<p>
<label>
Select Race:
</label>
<select id="Race">
<option value="human">Human</option>
<option value="faela">Faela</option>
<option value="domovoi">Domovoi</option>
<option value="arcon">Arcon</option>
<option value="tsaaran">Tsaaran</option>
</select>
<label for="range">Select Age:</label> <input type="range" min="14" max="76" id="slider" value="10" name="range"><span id="output">. </span>