The next step is to create a function for each of the actions that the script is to perform and attach them to the appropriate HTML so that they will be called when the event that is to trigger that action occurs. Usually I'll just stick an alert in each to start with just to give me a way to check that each function gets called at the appropriate time. I usually test the script in at least one browser a number of times as I progressively write the script so as to ensure that each piece works correctly before moving on to write the next piece. Where the script involves code that will work differently in different browsers I'll do at least some testing along the way in additional browsers so as to test each path through that part of the code.
At this point I concentrate on getting the code to function correctly when valid information is input to it.Where the script is going to be processing information from a form I leave adding the validations of those fields until after I get the code working correctly for valid input. It is only after I have the script working correctly with valid input that I then look at adding all of the extra code necessary to validate whatever has been fed into the script in the first place. Often this validation code will be as long or longer than the code that actually does the processing but as I can usually copy validation code that I have used previously in other scripts, adding this part of the code is usually much quicker than writing the main functioning of the script. Where the script doesn't rely on any user input there may not even be a need to add any actual validations.
Once the script is finished and cleaned up I then move the script out of the web page into its own separate file and update the script tag to reference that file. The script is now ready to upload to the web.