/    Sign up×
Community /Pin to ProfileBookmark

<html>
<head>
<title>Form Example</title>
<META NAME=”Generator” CONTENT=”Stone’s WebWriter 3.5″>
<script LANGUAGE=”JavaScript”>
function display() {
DispWin = window.open(”,’NewWin’, ‘toolbar=no,status=no,width=300,height=200’)
message = “<ULul><LIli><b>NAME: </b>” + document.form1.name.value;
message += “<LIli><b>address: </b>” + document.form1.address.value;
message += “<LIli><b>PHONE: </b>” + document.form1.phone.value + “</ULul>”;
message += “<input type=’button’ value=’Close Window’ onclick=’self.close();’ />”
DispWin.document.write(message)
}

window.status = ” Merry Christmas! Merry Christmas! “;
function scrollStatusBar()

{
var message = window.status;
window.status = message.substring(1) + message.substring(0, 1);
}
function calcPrice(i)
{
var price = document.order.price[i].value;
var qty = document.order.qty[i].value;
var total = price * qty;
document.order.total[i].value = total.toFixed(2);
if ( document.order.tick[i].checked!=true)
document.order.tick[i].checked=true;
}

function checkQty(i)
{
if (document.order.tick[i].checked==true)
{
if (document.order.qty[i].value == “”)
{
alert(“Please enter the quantity you require!”);
document.order.qty[i].focus();
}
}
else
{
document.order.qty[i].value = “”;
document.order.total[i].value = “”;
}
}

//work out the total order for the user
//using a increment operator (++) allows the user to increase the order/quantity if they wish
//parsefloat will convert a string symbol to a floating-point number (decimals)

function totalOrder()
{
var yourTotal=0;
for(i=0; i<0; ++i)
{
if ( document.order.tick[i].checked==true)
{
var thisAmount = parseFloat(document.order.total[i].value);
yourTotal += thisAmount;
}
}
yourTotal = “$” + yourTotal.toFixed(2);
document.order.grandTotal.value=yourTotal;
}
// has the array of days and months in sequence
//declaring variables in order to gather the current date to work out how many days until Xmas

var days = new Array(“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”);
var months = new Array(“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”);

var today = new Date();
var myDay = today.getDate();
var myMonth = today.getMonth();
var myYear = today.getYear();

var myDate = myDay + ” ” + months[myMonth]+ “, ” + myYear;

//formaltes a count down method for days left until Xmas
//create a alert box to inform user how many days left until Xmas

function countDown()
{
var xmasDay = new Date(2005, 12, 25);
var now = new Date(myYear, myMonth, myDay);
var daysToXmas = Math.round((xmasDay – now) / 86400000);
alert(“Only ” + daysToXmas + ” sleeps until Christmas!” );
}

// Stop hiding from incompatible browsers –>
</SCRIPT>
</HEAD>
<BODY onload=”setTimeout(‘countDown();’, 10000);”>
<body onload=”setInterval(‘scrollStatusBar()’,100)” background-image: BACKGROUND=”SNFLAKE2.WMF”>

<a onmouseover=”window.status = ‘ Merry Christmas! ‘” onmouseout=”window.status = ‘ Merry Christmas! ‘”></a>
<form name=”form1″>
<P>First name:&nbsp;<INPUT size=30 name=box1></P>
<P>Last name:&nbsp;<INPUT size=30 name=box2></P>
<P>address:&nbsp;<INPUT size=40 name=box3></P>
<P>postcode:&nbsp;<INPUT size=7 name=box4></P>
<P>telephone:&nbsp;<INPUT size=15 name=box5></P>
<P>Age:&nbsp;<INPUT size=10 name=Age></P>
<P>credit card number:&nbsp;<INPUT size=10 name=box6></P>
<P>expiry date:&nbsp;<INPUT size=10 name=box7></P><BR><FORM NAME=”order”>
<TABLE border=1>
<TBODY>
<TR>
<TD>description</TD>
<TD>Select</TD>
<TD>Price</TD>
<TD>Quantity</TD>
<TD>Total</TD></TR>
<TR>
<TD><A HREF=”Delicate glass angel 5cm.htm”>Delicate glass angel 5cm</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”> </TD>
<TD><input type=”text” name=”price” value=”14.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”green bauble.htm”>green bauble</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”11.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TD><A HREF=”red bauble.htm”>red bauble</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”11.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TD><A HREF=”blue bauble.htm”>blue bauble</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”11.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”3 baubles.htm”>3 baubles</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”26.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”red bow.htm”>red bow</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”4.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”blue bow.htm”>blue bow</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”4.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”candy cane.htm”>candy cane</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”3.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TR>
<TD><A HREF=”candle centrepeice.htm”>candle centrepeice</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”19.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TR>
<TD><A HREF=”outside light.htm”>outside light</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”29.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”santaface.htm”>santaface</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”12.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”santas hat.htm”>santas hat</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”12.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”rocking horse.htm”>rocking horse</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”129.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD><A HREF=”wreath.htm”>wreath</A></TD>
<TD><input type=”checkbox” name=”tick” onclick=”checkQty(0);”></TD>
<TD><input type=”text” name=”price” value=”39.95″ READONLY /></TD>
<TD><input type=”text” name=”qty” border=”0″ onchange=”calcPrice(0);”/ SIZE=10></TD>
<TD><input type=”text” name=”total” /></TD>
</TR>
<TR>
<TD colspan=”4″ align=”right” >Your Order Total</TD>
<TD><input type=”text” name=”grandTotal” /></TD>
</TR>
</TABLE>
<br />
<br />
<input type = “button” value=”Total Order” onclick=”totalOrder();” />
<br />
<br />

<p><input TYPE=”BUTTON” VALUE=”Display” onClick=”display();”></p>
</form>
<!– WebWriter AutoDato –>Last updated 13.5.2005<!– WW –>
</body>
</BODY>
</html>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @user_20 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...