Download CSCI 2910 JavaScript Quiz Part 3 - Prof. David L. Tarnoff and more Quizzes Computer Science in PDF only on Docsity! Spring 2007 – CSCI 2910 JavaScript Part 3 Quiz Name: ________________________________ 1. Below is a list of four objects. From the list, pick only two and describe the arguments (args) that are passed to their constructor functions. Array – Image – String – Date – 2. To change the picture displayed in an Image object, you need to assign a new URL to what property of the Image? 3. Below is the constructor for a custom object called webWindow. In the space below the constructor, write the code to create an instance of webWindow called mywindow that is 600 pixels by 400 pixels with a URL of http://www.xyz.com. (The dimensions are integers while the URL is a string.) function webWindow(url, width, height) { this.webURL = url; this.window_width = width; this.window_height = height; } 4. Most predefined objects have a function called _________ which returns the values or a description of the object in the form of a string that can be output to the client. a.) toString() b.) output() c.) toValues() d.) properties() e.) write() f.) alert() g.) sendString() 5. The keyword ______ is used to identify the current instance being created by the constructor. a.) object b.) isself c.) here d.) getself e.) id f.) this g.) my 6. The property of the String object that returns the number of characters in the string is: a.) length b.) count c.) countof d.) numchar e.) chars f.) index g.) array 7. The code page.prototype.setColor = function(color) is used to: a.) format a new page with a background color of color b.) define a constructor for the object page c.) define a constructor for the object setColor d.) set color of page equal to the value returned by the function function(color) e.) define a function called setColor() for the object page 8. In order to access the object properties and methods of an HTML element, we must declare an object instance that points to that HTML element. This is done with the ________ method. a.) getHTMLObject() b.) getHTMLElement() c.) getWebElement() d.) getElementById() e.) elementToInstance() f.) accessHTMLElement() 9. Convert the following CSS property names to their corresponding JavaScript Property names: font-family border-left-color