newbie_20
05-24-2005, 08:31 AM
i have tried to work out whats wrong wit it keeps saying document.write.tick and document.write.price is null or not an object.
i laso need to write in that if order is under $200 a delivery fee of $15 applies if greater than $200 a fee of $12 applies
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Generating a new page</TITLE>
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2900.2627" name=GENERATOR>
<SCRIPT>
<!-- Hide from incompatible browsers
//This program will allow people to click on a link to show a certain product and order which Christmas item they desire.
//each function will assign a name to an eventto call on rather then repeating the commands.
//Each variable declared assigns a word repserentation to line of code.
function newPage()
{
var myString = "your name is " + myForm.box1.value + " " + myForm.box2.value + ""+ "your address is " + myForm.box3.value + "<br> " + myForm.box4.value + ""+ "your telephone is "+ myForm.box5.value+ ""+ "your credit card number is " + myForm.box6.value + ""+ "your expiry date is" + myForm.box7.value
var myNewPage = window.open("","", "height=300","width=300");
myNewPage.document.write(myString)
}
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;
}
//getMonth method will return a number (1-12) repsrenting the month: getYear() will return two digits for the year (eg-99)
//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);setInterval('scrollStatusBar()',100)"
BACKGROUND="SNFLAKE2.WMF">
<a onmouseover="window.status = ' Merry Christmas! '" onmouseout="window.status = ' Merry Christmas! '"></a>
<FORM name=myForm>
<P>First name: <INPUT size=30 name=box1></P>
<P>Last name: <INPUT size=30 name=box2></P>
<P>Address: <INPUT size=40 name=box3></P>
<P>postcode: <INPUT size=7 name=box4></P>
<P>telephone: <INPUT size=15 name=box5></P>
<P>Age: <INPUT size=10 name=Age></P>
<P>credit card number: <INPUT size=10 name=box6></P>
<P>expiry date: <INPUT size=10 name=box7></P><BR>
<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>
<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>
<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>
<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>
<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>
</TBODY>
</TABLE>
<br />
<br />
<input type = "button" value="Total Order" onclick="totalOrder();" />
<br />
<br />
<INPUT onclick=newPage(); type=button value="display page">
<br/>
</FORM>
<!-- WebWriter AutoDato -->Last updated 24.5.2005<!-- WW -->
</body>
</HTML>
i laso need to write in that if order is under $200 a delivery fee of $15 applies if greater than $200 a fee of $12 applies
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Generating a new page</TITLE>
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2900.2627" name=GENERATOR>
<SCRIPT>
<!-- Hide from incompatible browsers
//This program will allow people to click on a link to show a certain product and order which Christmas item they desire.
//each function will assign a name to an eventto call on rather then repeating the commands.
//Each variable declared assigns a word repserentation to line of code.
function newPage()
{
var myString = "your name is " + myForm.box1.value + " " + myForm.box2.value + ""+ "your address is " + myForm.box3.value + "<br> " + myForm.box4.value + ""+ "your telephone is "+ myForm.box5.value+ ""+ "your credit card number is " + myForm.box6.value + ""+ "your expiry date is" + myForm.box7.value
var myNewPage = window.open("","", "height=300","width=300");
myNewPage.document.write(myString)
}
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;
}
//getMonth method will return a number (1-12) repsrenting the month: getYear() will return two digits for the year (eg-99)
//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);setInterval('scrollStatusBar()',100)"
BACKGROUND="SNFLAKE2.WMF">
<a onmouseover="window.status = ' Merry Christmas! '" onmouseout="window.status = ' Merry Christmas! '"></a>
<FORM name=myForm>
<P>First name: <INPUT size=30 name=box1></P>
<P>Last name: <INPUT size=30 name=box2></P>
<P>Address: <INPUT size=40 name=box3></P>
<P>postcode: <INPUT size=7 name=box4></P>
<P>telephone: <INPUT size=15 name=box5></P>
<P>Age: <INPUT size=10 name=Age></P>
<P>credit card number: <INPUT size=10 name=box6></P>
<P>expiry date: <INPUT size=10 name=box7></P><BR>
<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>
<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>
<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>
<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>
<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>
</TBODY>
</TABLE>
<br />
<br />
<input type = "button" value="Total Order" onclick="totalOrder();" />
<br />
<br />
<INPUT onclick=newPage(); type=button value="display page">
<br/>
</FORM>
<!-- WebWriter AutoDato -->Last updated 24.5.2005<!-- WW -->
</body>
</HTML>