Tror du at du kan gennemskue og se fidusen i dette og selv udvide med layout til side 2?
<%@ language="vbscript" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"> <html>
<head>
<meta http-equiv="Content-Language" content="da">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Computer</title>
<style type="text/css">
#confirmation { display:none; }
</style>
<script type="text/javascript">
samletpris=0
cpupris=0
rampris=0
grafikpris=0
function Product(id,price,text) {
this.id = id;
this.price = price;
this.text = text;
}
var objProducts = new Array(
new Product(1,10,'Intel Pentium 4 2.8 GHz'),
new Product(2,20,'Intel Pentium 4 3.0 GHz'),
new Product(3,30,'Intel Pentium 4 3.2 GHz'),
new Product(4,10,'512 DDR3200'),
new Product(5,20,'1024 DDR3200'),
new Product(6,30,'2048 DDR3200'),
new Product(7,10,'ASUS AX850XT 256 MB GDDR3'),
new Product(8,20,'ATI RADEON 9200 128 MB DDR SDRAM'),
new Product(9,30,'GeForce 6800 GT 256 MB GDDR3')
);
// lav en funktion på objProducts-array'et, så den kan kaldes direkte derpå
objProducts.findProduct = function(id) {
// find produktet
for(var i = 0; i < this.length; i++) {
if(this[i].id == id)
return this[i];
}
return null;
}
function beregn(obj) {
if(obj) {
// find produktet
var objProduct = objProducts.findProduct(obj.value);
if(objProduct) {
if(obj.name=="Cpu") cpupris = parseFloat(objProduct.price);
if(obj.name=="Ram") rampris = parseFloat(objProduct.price);
if(obj.name=="GraphicCard") grafikpris = parseFloat(objProduct.price);
samletpris = cpupris + rampris + grafikpris;
obj.form.totalpris.value = samletpris
}
}
}
function listProducts() {
function generateProdLine(id) {
// find produktet
var objProduct = objProducts.findProduct(id);
if(objProduct) {
var strProdLine = "<tr><td>" + objProduct.text + "</td>"
+ "<td>" + objProduct.price + "</td></tr>";
return strProdLine;
}
return "Produkt med id: " + id + " ikke fundet...";
}
var strHTML = "<table>";
var cpuprods = document.getElementsByName("Cpu");
var ramprods = document.getElementsByName("Ram");
var gfxprods = document.getElementsByName("GraphicCard");
for(var i = 0; i < cpuprods.length; i++) {
if(cpuprods[i].checked) {
strHTML += generateProdLine(cpuprods[i].value);
break;
}
}
for(var i = 0; i < ramprods.length; i++) {
if(ramprods[i].checked) {
strHTML += generateProdLine(ramprods[i].value);
break;
}
}
for(var i = 0; i < gfxprods.length; i++) {
if(gfxprods[i].checked) {
strHTML += generateProdLine(gfxprods[i].value);
break;
}
}
strHTML += "</table>";
document.getElementById("compilation").innerHTML = strHTML;
}
function changePage(pageid) {
if(pageid == 1) {
document.getElementById("selections").style.display = "block";
document.getElementById("confirmation").style.display = "none";
}
else if(pageid == 2) {
listProducts();
document.getElementById("selections").style.display = "none";
document.getElementById("confirmation").style.display = "block";
}
}</script>
</head>
<body link="#000000" vlink="#000000" alink="#000000" bgcolor="#CCCCCC">
<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan -->
<script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{
if (theForm.Postcode.value == "")
{
alert("Please enter a value for the \"Postcode\" field.");
theForm.Postcode.focus();
return (false);
}
if (theForm.Postcode.value.length < 4)
{
alert("Please enter at least 4 characters in the \"Postcode\" field.");
theForm.Postcode.focus();
return (false);
}
if (theForm.Postcode.value.length > 4)
{
alert("Please enter at most 4 characters in the \"Postcode\" field.");
theForm.Postcode.focus();
return (false);
}
var checkOK = "0123456789-";
var checkStr = theForm.Postcode.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"Postcode\" field.");
theForm.Postcode.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan -->
<form method="POST" action="_vti_bin/shtml.dll/computer.htm" onSubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1" webbot-action="--WEBBOT-SELF--" ID="Form1">
<!--webbot bot="SaveResults" u-file="besvar.htm" s-format="HTML/BR" s-label-fields="TRUE" b-reverse-chronology="FALSE" s-date-format="%y-%m-%d" s-time-format="%H:%M" s-builtin-fields="Date Time" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0" ID="Hidden1"><!--webbot bot="SaveResults" endspan i-checksum="43374" -->
<div id="selections">
<p>Here you can compile your own computer:</p>
<p>Price: </p>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="15%">CPU:</td>
<td width="65%">Beskrivelse:</td>
<td width="20%">Priser:</td>
</tr>
<tr>
<td width="15%"><input type="radio" value="1" name="Cpu" onclick="beregn(this)"></td>
<td width="65%">Intel pentium 4 2.8 Ghz</td>
<td width="20%">10</td>
</tr>
<tr>
<td width="15%"><input type="radio" value="2" name="Cpu" onclick="beregn(this)"></td>
<td width="65%">Intel pentium 4 3.0 Ghz</td>
<td width="20%">20</td>
</tr>
<tr>
<td width="15%"><input type="radio" value="3" name="Cpu" onclick="beregn(this)"></td>
<td width="65%">Intel pentium 4 3.2 Ghz</td>
<td width="20%">30</td>
</tr>
<tr>
<td width="15%"> </td>
<td width="65%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="15%">Ram:</td>
<td width="65%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="15%"><input type="radio" value="4" name="Ram" onclick="beregn(this)"></td>
<td width="65%">512 DDR3200</td>
<td width="20%">10</td>
</tr>
<tr>
<td width="15%"><input type="radio" value="5" name="Ram" onclick="beregn(this)"></td>
<td width="65%">1024 DDR3200</td>
<td width="20%">20</td>
</tr>
<tr>
<td width="15%"><input type="radio" value="6" name="Ram" onclick="beregn(this)"></td>
<td width="65%">2048 DDR3200</td>
<td width="20%">30</td>
</tr>
<tr>
<td width="15%"> </td>
<td width="65%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="15%">Graphics Cards:</td>
<td width="65%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="15%"><font face="Times New Roman">
<input type="radio" name="GraphicCard" value="7" onclick="beregn(this)"></font></td>
<td width="65%"><font face="Times New Roman">
ASUS AX850XT 256 MB GDDR3</font></td>
<td width="20%">10</td>
</tr>
<tr>
<td width="15%"><font face="Times New Roman">
<input type="radio" name="GraphicCard" value="8" onclick="beregn(this)"></font></td>
<td width="65%"><font face="Times New Roman">
ATI RADEON 9200 128 MB DDR SDRAM</font></td>
<td width="20%">20</td>
</tr>
<tr>
<td width="15%"><font face="Times New Roman">
<input type="radio" name="GraphicCard" value="9" onclick="beregn(this)"></font></td>
<td width="65%"><font face="Times New Roman">
GeForce 6800 GT 256 MB GDDR3</font></td>
<td width="20%">30</td>
</tr>
</table>
<p><input type="text" name="totalpris" size="20" readonly="true"><br>
</p>
<hr>
<font face="Times New Roman">Name:</font><br>
<input type="text" name="Name" size="30"><br>
Address:<br>
<input type="text" name="Address" size="30"><br>
Postcode:<br>
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="x" b-value-required="TRUE" i-minimum-length="4" i-maximum-length="4" -->
<input type="text" name="Postcode" size="4" maxlength="4"><br>
Town:<br>
<input type="text" name="Town" size="30"><br>
E-Mail:<br>
<input type="text" name="Mail" size="30"><br>
<br>
<input type="button" value="Bekræft" name="confirmCompilation" onclick="changePage(2);">
</div>
<div id="confirmation">
<div id="compilation"> </div>
<input type="button" value="Tilbage" name="Back" onclick="changePage(1);">
<input type="submit" value="Send" name="send">
</div>
</form>
<p> </p>
</body>
</html>