HTML and CSS Reference
In-Depth Information
f. Create a variable named
timetext
containing the text
[
hours
:
minutes
:
seconds
]
where
hours
,
minutes
, and
seconds
are the values of the
hours
,
minutes
, and
seconds
variables, respectively.
g. Using the
unshift()
array method, insert the value of the
timeText
variable at
the start of the
bidTime
array.
h. Call the writeBid() function to write the complete array of bids to the Web page.
Remember that there are no parameters required for this function.
6.
Create a function named
removebid()
. The purpose of this function is to remove the
first entry from the
bidders
,
bids
, and
bidTime
arrays. Add the following commands
to the function:
a. Using the
shift()
array method, remove the first entry from the
bidders
array.
b. In the same way, use the
shift()
method to remove the first entry from the
bids
and
bidTime
arrays.
c. Call the writeBid() function to rewrite the revised array of bids to the Web page.
7. Document your work with comments throughout the code.
8. Save your changes to the file, and then return to the
auction.htm
file in your text
editor.
9. Scroll down the document to the Submit input button. Add an event handler attri-
bute to run the addBid() function when the button is clicked.
10. Add an event handler attribute to the Remove Last Bid button to run the removeBid()
function when the button is clicked.
11. Save your changes to the file, and then open
auction.htm
in your Web browser.
Enter new bids in the
Bidder ID
and
Bid Amount
input fields. Click the Submit but-
ton to update the bidding history and the
Latest Bid
field. Verify that the newest bid
entries are placed at the top of the bidding history. Click the Remove Last Bid button
and verify that the latest bid is removed from the list.
12. Submit your completed Web site to your instructor, in either printed or electronic
form, as requested.