Summary - CGS3066: Web Programming and Design Summer 2014
7. How do you write "Hello World" in an alert box? A. alertBox("Hello World"); B. msgBox("Hello World"); C. msg("Hello World"); D. alert("Hello World"); 8. How do you create a function in JavaScript? A. function:myFunction() B. function myFunction() C.function = myFunction() 9.How does a FOR loop start? A. for (i = 0; i = 5; i++) B. for (i = 5; i++) C. for (i = 0; i = 5) D. for i = 1 to 5 10. How can you add a comment in a JavaScript? A. //This is a comment B. 'This is a comment C. !--This is a comment-- 11. JavaScript is the same as Java. A. Flase B. True 12. What JavaScript keyword declares a variable? A. var B. if C. for D. create 13. Write a function called insertText that inserts the string “Welcome to my site!” into an element with Id “para1”. 4 14. Write a function called changeBGColor that changes the background color of all elements which has Class name “classColor”. 4 15. Consider the following code segment- form Enter User Id: input type =”text” name=”userid” id=”userid” input type=”button” value=”Check User ID” onclick=”return chekID();” /form Write JavaScript code for chekcID() function, which checks the value entered userid field and return true if it contains only alphabet(A-Za-Z)/number(0-9)/_(underscore) otherwise return false. You may consider defining a regular expression(pattern) while implementing the function. 10
Written for
- Institution
- CGS3066: Web Programming and Design Summer 2014
- Course
- CGS3066: Web Programming and Design Summer 2014
Document information
- Uploaded on
- July 8, 2024
- Number of pages
- 2
- Written in
- 2023/2024
- Type
- SUMMARY
Subjects
-
cgs3066 web programming and design summer 2014