DIV, radiobutton og javascript
Her er lidt kode jeg har lånt fra et andet sted:)Mit problem er at jeg har brug for at indsætte \"radiobuttons\" i stedet for \"text\" og \"select\". Hvordan kan jeg indsætte radiobuttons og tjekke på værdien i et javascript???
<html>
<head>
<title>Seismic Loading Calculator</title>
</head>
<body BGCOLOR=\"Silver\">
<!-- Persistant Elements Begin -->
<img SRC=\"quake.gif\" STYLE=\"position:absolute; top:1; left:1;\" WIDTH=\"75\" HEIGHT=\"200\">
<hr STYLE=\"position:absolute; top:210; left:0;\">
<button DISABLED STYLE=\"position:absolute; top:220; left:295;\" ID=\"Back\" ACCESSKEY=\"N\" TITLE=\"Next\" onClick=\"goBack();\">
< Back
</button>
<button STYLE=\"position:absolute; top:220; left:365;\" ID=\"Next\" ACCESSKEY=\"N\" TITLE=\"Next\" onClick=\"goNext();\">
Next >
</button>
<button STYLE=\"position:absolute; top:220; left:428;\" ID=\"Finish\" ACCESSKEY=\"N\" TITLE=\"Cancel\" onClick=\"closedialog();\">
Cancel
</button>
<!-- Persistant Elements End -->
<div ID=\"Pane1\" STYLE=\"position:absolute; top:1; left:80; height:200; width:400; visibility: hidden;\">
<h4>Welcome to the Seismic Load Calculator</h4>
<p>This simple wizard will assist you in determining the maximum design base shear for the building you specify. This wizard\'s calculations are based on the 1994 Uniform Building Code.</p>
<p>Click Next to begin</p>
</div>
<div ID=\"Pane2\" STYLE=\"position:absolute; top:1; left:80; height:200; width:400; visibility: hidden;\">
<h4>Building Height</h4>
<p>What is the floor-to-floor height of the building in feet? <input TYPE=\"TEXT\" ID=\"dlgheight\" SIZE=\"3\" VALUE=\"15\"> feet</p>
<p>How many floors are in the building? <input TYPE=\"TEXT\" ID=\"dlgfloors\" SIZE=\"3\" VALUE=\"10\"> floors</p>
</div>
<div ID=\"Pane3\" STYLE=\"position:absolute; top:1; left:80; height:200; width:400; visibility: hidden;\">
<h4>Building Mass</h4>
<fieldset>
<legend>Building Dimensions</legend>
What is length of the building? <input TYPE=\"TEXT\" ID=\"dlglength\" SIZE=\"3\" VALUE=\"100\"> feet<br>
What is width of the building? <input TYPE=\"TEXT\" ID=\"dlgwidth\" SIZE=\"3\" VALUE=\"100\"> feet
</fieldset>
<fieldset>
<legend>Building Loading</legend>
What is the dead-load in psf for the building? <input TYPE=\"TEXT\" ID=\"dlgdead\" SIZE=\"3\" VALUE=\"20\"> psf<br>
What is the live-load in psf for the building? <input TYPE=\"TEXT\" ID=\"dlglive\" SIZE=\"3\" VALUE=\"50\"> psf
</fieldset>
</div>
<div ID=\"Pane4\" STYLE=\"position:absolute; top:1; left:80; height:200; width:400; visibility: hidden;\">
<h4>Building Importance</h4>
<p>The importance factor will add additional seismic load requirements to your building if your building is deamed an essential structure in a natural disaster.</p>
<fieldset>
<legend>Importance Factor</legend>
<select ID=\"dlgImport\">
<option CHECKED VALUE=\"1\">This is a standard building
<option VALUE=\"1.5\">This is an important, essential building
</select></fieldset>
</div>
<div ID=\"Pane5\" STYLE=\"position:absolute; top:1; left:80; height:200; width:400; visibility: hidden;\">
<h4>Building Structure</h4>
<p>Please specify the intended strcutural system. The intended structural system will take into account both the material selected and the ductility of the structural system selected.</p>
<fieldset>
<legend>Structural System</legend>
<select ID=\"dlgStructure\">
<option CHECKED VALUE=\"SMRF\">Steel Moment Resisting Frame
<option VALUE=\"CMRF\">Concrete Moment Resisting Frame
<option VALUE=\"SHER\">Rigid Shear Wall
<option VALUE=\"WOOD\">Plywood Shear Wall
</select>
</fieldset>
</div>
<div ID=\"Pane6\" STYLE=\"position:absolute; top:1; left:80; height:200; width:400; visibility: hidden;\">
<h4>Building Site</h4>
<p>Please specify the following information as indicated by your soils engineer or soils report.
<fieldset>
<legend>UBC Seismic Zone</legend>
<select ID=\"dlgZone\">
<option CHECKED VALUE=\"0.4\">Zone 4 (High Seismicity)
<option VALUE=\"0.3\">Zone 3
<option VALUE=\"0.2\">Zone 2
<option VALUE=\"0.1\">Zone 1 (Low Seismicity)
</select>
</fieldset>
<br>
<fieldset>
<legend>UBC Soil Factor</legend>
<select ID=\"dlgSoil\">
<option VALUE=\"1\">1.5 - Hard Soil
<option VALUE=\"1.2\">1.2 - Moderate Soil
<option CHECKED VALUE=\"1.5\">1.5 - Normal Soil
<option VALUE=\"2.0\">2.0 - Soft Soil
</select>
</fieldset>
</div>
<div ID=\"Pane7\" STYLE=\"position:absolute; top:1; left:80; height:200; width:400; visibility: hidden;\">
<h4>Send Data to the Server</h4>
<p>We have now collected all of the necissary information and we are ready to send that information to our server for processing.</p>
<p>Click \'Send\' when you are ready to send the information to the server</p>
</div>
<script LANGUAGE=\"JavaScript\" FOR=\"window\" EVENT=\"onLoad\">
document.all.Pane1.style.visibility = \"\";
</script>
<script LANGUAGE=\"JavaScript\">
var currentpane = 1;
function check2()
{
if ((isNaN(dlgheight.value) == true) || (dlgheight.value == \"\"))
{
alert(\"You must specify a real number for the floor-to-floor height of the building\");
return false;
}
if ((dlgheight.value > 15) || (dlgheight.value < 10))
{
alert(\"Please use a floor-to-floor height between 10 and 15 feet\");
return false;
}
if ((isNaN(dlgfloors.value) == true) || (dlgfloors.value == \"\"))
{
alert(\"You must specify a real number for the number of floors\");
return false;
}
if ((dlgfloors.value > 30) || (dlgfloors.value < 1))
{
alert(\"Our calculator is only approved for buildings under 30 stories\");
return false;
}
return true;
}
function check3()
{
if ((isNaN(dlglength.value) == true) || (dlglength.value == \"\"))
{
alert(\"You must specify a real number for the length of the building\");
return false;
}
if ((dlglength.value > 200) || (dlglength.value < 1))
{
alert(\"Our calculator is only approved for buildings less than 200 feet long\");
return false;
}
if ((isNaN(dlgwidth.value) == true) || (dlgwidth.value == \"\"))
{
alert(\"You must specify a real number for the width of the building\");
return false;
}
if ((dlgwidth.value > 200) || (dlgwidth.value < 1))
{
alert(\"Our calculator is only approved for buildings less than 200 feet long\");
return false;
}
if ((isNaN(dlgdead.value) == true) || (dlgdead.value == \"\"))
{
alert(\"You must specify a real number for the dead-load of the building\");
return false;
}
if ((dlgdead.value > 50) || (dlgdead.value < 1))
{
alert(\"Our calculator is only approved for buildings with a dead load less than 50 psf\");
return false;
}
if ((isNaN(dlglive.value) == true) || (dlglive.value == \"\"))
{
alert(\"You must specify a real number for the live-load of the building\");
return false;
}
if ((dlglive.value > 75) || (dlglive.value < 1))
{
alert(\"Our calculator is only approved for buildings with a dead load less than 75 psf\");
return false;
}
return true;
}
function goBack()
{
if (currentpane == 2)
{
document.all.Pane1.style.visibility = \"\";
document.all.Pane2.style.visibility = \"hidden\";
Back.disabled = 1;
}
if (currentpane == 3)
{
document.all.Pane2.style.visibility = \"\";
document.all.Pane3.style.visibility = \"hidden\";
}
if (currentpane == 4)
{
document.all.Pane3.style.visibility = \"\";
document.all.Pane4.style.visibility = \"hidden\";
}
if (currentpane == 5)
{
document.all.Pane4.style.visibility = \"\";
document.all.Pane5.style.visibility = \"hidden\";
}
if (currentpane == 6)
{
document.all.Pane5.style.visibility = \"\";
document.all.Pane6.style.visibility = \"hidden\";
}
if (currentpane == 7)
{
document.all.Pane6.style.visibility = \"\";
document.all.Pane7.style.visibility = \"hidden\";
Next.disabled = 0;
Finish.innerHTML = \"Cancel\";
}
currentpane -= 1
}
function goNext()
{
if (currentpane == 1)
{
document.all.Pane1.style.visibility = \"hidden\";
document.all.Pane2.style.visibility = \"\";
Back.disabled = 0;
}
if (currentpane == 2)
{
if (check2() == true)
{
document.all.Pane2.style.visibility = \"hidden\";
document.all.Pane3.style.visibility = \"\";
}
else
{
return false;
}
}
if (currentpane == 3)
{
if (check3() == true)
{
document.all.Pane3.style.visibility = \"hidden\";
document.all.Pane4.style.visibility = \"\";
}
else
{
return false;
}
}
if (currentpane == 4)
{
document.all.Pane4.style.visibility = \"hidden\";
document.all.Pane5.style.visibility = \"\";
}
if (currentpane == 5)
{
document.all.Pane5.style.visibility = \"hidden\";
document.all.Pane6.style.visibility = \"\";
}
if (currentpane == 6)
{
document.all.Pane6.style.visibility = \"hidden\";
document.all.Pane7.style.visibility = \"\";
Next.disabled = 1;
Finish.innerHTML = \"Send\";
}
currentpane += 1
}
function closedialog()
{
if (currentpane == 7)
{
strpath=\"seismic.asp?Stuff=Yes&Height=\" + dlgheight.value + \"&Floors=\" + dlgfloors.value + \"&Length=\" + dlglength.value + \"&Width=\" + dlgwidth.value + \"&Dead=\" + dlgdead.value + \"&Live=\" + dlglive.value + \"&Import=\" + dlgImport.value + \"&Stucture=\" + dlgStructure.value + \"&Zone=\" + dlgZone.value + \"&Soil=\" + dlgSoil.value
window.returnValue = strpath;
window.close();
}
else
{
if (confirm(\"Are you sure that you want to quit?\"))
{
window.close();
}
}
}
</script>
</body>
</html>
