FrustratedStudent Posted August 16, 2011 Share Posted August 16, 2011 I have NO idea what I'm doing wrong here. This is only a portion of the whole code, but I have no idea if any of it is working. I figured I'd start at the top...The function is not supposed to have a parameter for it, the loop is supposed to update the historyText text and then write it to a form box (bidList).I just need to know what is wrong and an idea of how to fix it - I don't want the code fixed for me... function writeBid(); { var historyText = ""; //variable text string for (bidTime=0;i < bids; bidders++) \n { document.bidForm.bidList.value = historyText(); //write the value of history text to text box bidList document.bidForm.highBid.value = highBid(); //write value of the first item in the bids array to the highBid field document.bidForm.bidList.value = null; //set the value of bidList to empty text string document.bidForm.highBid.value = null; //set the value of bidAmount to empty text string } } Link to comment Share on other sites More sharing options...
JamesB Posted August 16, 2011 Share Posted August 16, 2011 you don't need the semi colon on the first line, or the \n in the for loop linehistoryText is set to type string, but you try to call it with () after it, which won't work as it's not a functionthe for loop variables seem a bit strange, if you just want to loop for the amount of bids, it's common to use the same variable in all 3 parts: for (var i=0; i<bids; i++)to set a input text to an empty string, i think it would be better to use an empty js string instead of null, ie. '' Link to comment Share on other sites More sharing options...
FrustratedStudent Posted August 16, 2011 Author Share Posted August 16, 2011 Thanks! I changed all that, but I still can't get anything to work.I think I have a problem with my coding for the input buttons. Is this the proper way to write the event handler? <th id="buttons" colspan="2"> <input type="button" value="Submit" onsubmit="addBid()"/> <input type="button" value="Remove Last Bid" onsubmit="removeBid()"/> </th> Link to comment Share on other sites More sharing options...
JamesB Posted August 16, 2011 Share Posted August 16, 2011 I think the onsubmit event is only for the <form> tag, try changing it to onclick Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.