Landing : Athabascau University

Unit 5: Writing javascript

  • Public
By Jiaying Zhao in the group COMP 266 May 22, 2021 - 2:15pm

This assignment is based on unit 4, which has written the page in JavaScript language to realize the local interactive effect on the page. Later, I checked the assignment again and found that contact_ The form submission in us.html page does not execute the corresponding script operation, so in this unit, I develop and debug the function of the form. I have a specific ID value for the DOM element of each input box in the form. JavaScript language obtains the input value of each input box through the ID and value attributes. I set two buttons in the form, which are form submit button and form reset button. At the same time, I write in-line JavaScript to these two buttons. I use the method of onclick = ", which calls the specified event when the mouse clicks. When the user clicks the submit button, the handlesubmit method is executed. In the handlesubmit method, I judge whether gender, name, last name, e-mail and mobile phone number are empty. The condition judgment is realized by if and else statements. When the gender is empty, the message "gender cannot be empty" will pop up. When the surname is empty, the message "surname cannot be empty" will pop up. When the name is empty, the message "name cannot be empty" will pop up. When the e-mail is empty, the message "e-mail cannot be empty" will pop up. When the mobile phone number is empty, the message "mobile phone number cannot be empty" will pop up. I passed the console. Log print test for every if statement. When the user clicks the reset button, the handlereset method is executed to get the value value of DOM element through ID and reset the empty string to achieve the effect of form reset.  directory_unit5.zip

This is my website: http://student.athabascau.ca/~jiayingzh/directory_unit5/

Comments

These comments are moderated. Your comment will not be visible unless accepted by the content owner.

Only simple HTML formatting is allowed and any hyperlinks will be stripped away. If you need to include a URL then please simply type it so that users can copy and paste it if needed.

(Required)

(Required)


Group members: this is the place for your learning diary. Use this to post your zipped-up site at least once each unit, and your reflections as often as you wish (at least once per unit). Please write your reflections directly in the post, not as attached files. Where you do need to attach documents, such as for unit 1 designs, use PDF, PNG or JPG formats. You can attach files using the 'Embed content' link in the editor.

QUICK COURSE LINKS:  Add blog post - Read latest group postsFAQs: Course process : Site design : HTML : CSS : JavaScript : JQuery : AJAX : Misc