Do you know that? 10% of new freelancers are earning $100 or more per hour. next

Contact Email: teammmrem@yahoo.com

<< All Upwork (oDesk) and Elance Tests << Upwork (oDesk) test answers << Internet Programming category

Test answers for DHTML Test 2016

(13 / 82, CL) Last updated: August 8
Upwork (oDesk) • Internet Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:



Collapse | Expand

13 Answered Test Questions:

1. After clicking on a link, your main browser window spawns a small new window and writes some text on it. When both the window page sources are viewed, the small window page source seems identical to that of the large one. Which of the following makes this happen?

Answers:

• The function writing to the new window did not close the document stream

• Windows receive the source code of the window that wrote to them

• Since the new window has no filename, it receives the source code of its parent

• None of the above

2. DHTML is a standard defined by the World Wide Web Consortium.

Answers:

• True

• False

3. How would you double the image size of an Image on a mouseover event, if the original width and height are 100px and id is logo?

Answers:

• document.getElementById('logo').style.width="200" document.getElementById('logo').style.height="200"

• document.getElementById('logo').style.width="100" document.getElementById('logo').style.height="100"

• document.getElementById('logo').width="200" document.getElementById('logo').height="200"

• document.getElementById('logo').width="200px" document.getElementById('logo').height="200px"

4. Choose another way to write x ? a = b : a = c

Answers:

• if ('x') { a = b; } else { a = c; }

• if (x) { a = c; } else { a = b; }

• x : a = c ? a = b

• None of the above

5. For making the text transparent, the mask filter can be used like:

Answers:

• mask(color=#ff00ff)

• mask(color=#ffffff)

• mask(#ffffff)

• mask(#ff00ff)

6. Your website displays a few articles on java programming. If you want to leave '1 cm' space above and below the code blocks, you would use code { margin-top:1cm ; margin-bottom:1cm }.

Answers:

• True

• False

7. Consider the following validate function:

<script type="text/javascript">
function ValidateField()
{
        if(document.forms[0].txtId.value =="")
                {return false;}

        return true;
}
</script>

This function should be called as soon as the user leaves the field. What will you do?

Answers:

• <input name=txtId type="text" onreset="return ValidateField()">

• <input name=txtId type="text" onfocus="return ValidateField()">

• <input name=txtId type="text" onsubmit="return ValidateField()">

• <input name=txtId type="text" onblur="return ValidateField()">

8. An HTML form has 10 checkboxes which are all named "chkItems". Which JavaScript function can be used for checking all the checkboxes together?

Answers:

• function CheckAll() { for (z = 0; z < document.forms.chkItems.length; z++) { document.forms.chkItems[z].checked=true } }

• function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems[z].checked=true } }

• function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=true } }

• function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=false } }

9. Following is a sample CSS style:

1. p
2. (
3. font-family:arial
4. color:black
5. text-align:left
6. );

What are the corrections required in this style?

Answers:

• The style definition should be enclosed in curly braces

• Multiple items within a style should be separated by ";"

• The style should not close with a semicolon

• All of the above

10. Consider an HTML form with a checkbox and a text field. When data is entered and the Enter key is pressed, the data seems to be lost before the user can click on the button that calls the processing function. How would you correct this programatically?

Answers:

• Add a TYPE=HIDDEN INPUT to the form

• Trap the Enter keypress and return (null)

• Add 'return false' to onsubmit="..." in the FORM tag

• Instruct the user not to press the Enter key

• Modify the ENCTYPE property of the form

11. Given below is a window.open function:

        window.open(url,name,"attributes")

How will you ensure that different URLs open in the same window?

Answers:

• By keeping the second attribute name same

• By nullifying the name attribute

• By omitting the name attribute

• None of the above

12. Consider the three variables:

someText = 'JavaScript1.2';
pattern = /(\w+)(\d)\.(\d)/i;
outCome = pattern.exec(someText);

What does pattern.ignoreCase contain?

Answers:

• true

• false

• undefined

• null

• 0

13. DHTML uses a combination of:

Answers:

• HTML

• A scripting language

• Cascading style sheets

• All of the above


82 NOT Answered Yet Test Questions:

(hold on, will be updated soon)
14. The width of H1 is defined as follows:

H1 {width:100px;}

How can you make the heading flip horizontally?

Answers:

• <h1 filter(flip)>Heading</h1>

• <h1 style="filter::fliph()">Heading</h1>

• <h1 style="filter:fliph()">Heading</h1>

• <h1 style="FliphFilter()">Heading</h1>

15. Which of the following statements is true with regard to setTimeout()?

Answers:

• The statement(s) it executes run(s) only once

• It pauses the script in which it is called

• clearTimeout() does not stop its execution

• It is required in every JavaScript function

16. Which of the following is not a JavaScript event?

Answers:

• onabort

• onchange

• onupdate

• onkeydown

17. Which of the following helps you create hyperlinks without an underline?

Answers:

• a{text-decoration:none}

• a{text-decoration:noline}

• a{text-decoration:hide}

• a{text-decoration:invisible}

• a{ font-style: normal;}

• a{font-style: none;}

18. Which of the following is not a CSS filter?

Answers:

• alpha

• beta

• xray

• invert

19. Which of the following enables JavaScript Document Object Model to provide access to the HTTP header?

Answers:

• document.GetHeader()

• document.getId('header')

• document.getElementByName('header')

• document.getElementById('header')

• You cannot read the HTTP header information using JavaScript

20. How would you change the image position from absolute to relative, if the image id is "ERImage"?

Answers:

• document.getElementById('ERImage').position="relative"

• document.getElementById('ERImage').setAttribute("position", "relative")

• document.getElementById('ERImage').style.position="rel"

• document.getElementById('ERImage').style.position="relative"

21. Which of the following properties of JavaScript is used to store the extra values for DHTML tricks?

Answers:

• DHTML

• HTML

• innerHTML

• outerHTML

22. This is a JavaScript function for changing the color of the text box named "txtName":

function SetColor(col)
{ document.forms[0].txtName.style.background=col }

How will you change the color of the text box txtName to green, only for the time that the user is pressing any key?

Answers:

• <input type="text" onkeydown="SetColor('white')" onkeyup="SetColor('green')" name="txtName">

• <input type="text" onkeydown="SetColor('green')" onkeyup="SetColor('white')" name="txtName">

• <input type="text" onkeydown="SetColor('green')" name="txtName">

• <input type="text" onkeydown="SetColor('white')" name="txtName">

23. Which of the following properties is used to redirect a visitor to another page?

Answers:

• document.URL

• window.location.href

• document.location.href

• link.href

• window.location

24. Which of the following can you use to accept user input?

Answers:

• The prompt method

• The alert method

• A form field

• The confirm method

25. Which of the following code snippets is more efficient and why?

<script language="javascript">
     for(i=0;i<document.images.length;i++)
          document.images[i].src="blank.gif";

</script>


<script language="javascript">
     var theimages = document.images;
     for(i=0;i<theimages.length;i++)
          theimages[i].src="blank.gif"
</script>

Answers:

• Both are equally efficient

• The first code is more efficient as it contains less coding

• The first code is more efficient as it employs object caching

• The second code is more efficient as it employs object caching

26. Which of the following statements with regard to CSS is correct?

Answers:

• The positioning can be absolute, relative, or dynamic

• The float property for text/image can be left, right, or center

• The values for visibility can be true or false

• The display property sets how an element is displayed

27. Which of the following helps you highlight some of the running text on a web page?

Answers:

• <span style="background-color:yellow">

• <span style="background-highlight:yellow">

• <span style="background:yellow">

• <span style="highlight-color:yellow">

28. You want to move all the paragraphs 30px towards the right relative to their normal position. The style definition should be:

Answers:

• p.relt{ position:relative; left:30px;}

• p.relt{ position:relative; left:-30px;}

• p{ position:relative; left:30px;}

• p{ position:relative; left:-30px;}

29. Which of the following is not considered a part of DHTML?

Answers:

• JavaScript

• CSS

• HTML

• VBScript

• All are part of DHTML

30. You do not want the end user to see the JavaScript code embedded in the HTML file when the user views the source of the HTML page. Which of the following helps you achieve this?

Answers:

• This is not possible

• Use externally linked files which hold the JavaScript code

• Modify the headers of the page

• Change the MIME type of the page

31. You want to move some selected paragraphs 15px towards the left relative to their normal position. The style definition should be like:

Answers:

• p.relt{ position:relative; left:15px;}

• p.relt{ position:relative; left:-15px;}

• p{ position:relative; left:15px;}

• p{ position:relative; left:-15px;}

32. How would you randomly choose an element from an array named myStuff if the number of elements changes dynamically?

Answers:

• randomElement = myStuff[Math.floor(Math.random() * myStuff.length)];

• randomElement = myStuff[Math.ceil(Math.random() * myStuff.length)];

• randomElement = myStuff[Math.random(myStuff.length)];

• randomElement = myStuff[Math.ceil(Math.random()*myStuff.length - 1)];

33. The anchor tag is defined as follows:

<a href="http://expertrating.com">expertrating</a>

Which of the following styles will make convert this to capital letters on mouseover?

Answers:

• a:hover { text:ucase;}

• a:hover { text-style:uppercase;}

• a:hover { text-transform:uppercase;}

• a:hover { text-style:upper;}

34. The width of h3 is defined as follow:

H3 {width:100%;}

How can you make the heading glow?

Answers:

• <h3 filter(glow)>Heading</h3>

• <h3 style="filter:glow()">Heading </h3>

• <h3 style="filter::glow()">Heading </h3>

• <h3 style="GlowFilter()">Heading </h3>

35. How will you display text as a superscript?

Answers:

• vertical-align: super

• vertical-align: superscript

• vertical-align: top

• text-align: super

• text-align: superscript

36. The width of h3 is defined as follows:

H3 {width:90%;}

How can you make the heading flip vertically?

Answers:

• <h3 filter(flip)>Heading</h3>

• <h3 style="filter:flipv()">Heading </h3>

• <h3 style="filter::flipv()">Heading </h3>

• <h3 style="FlipvFilter()">Heading </h3>

37. You want to shake a link on the mouseover event. If the style position is set to relative and the anchor id is lnk1, which of the following code lines will be useful with a timer?

Answers:

• document.getElementById('lnk1').left="0" document.getElementById('lnk1').left="2"

• document.getElementById('lnk1').style.left="0" document.getElementById('lnk1').style.left="2"

• document.getElementById('lnk1').style.move="0" document.getElementById('lnk1').style.move="2"

• document.getElementById('lnk1').right="0" document.getElementById('lnk1').right="2"

38. When does the load event of the browser occur?

Answers:

• When the browser receives the page header information

• When the browser starts displaying the content

• When the browser receives all the page information, including framesets

• When the browser receives all the page information, including framesets and displays it

• None of the above

39. Is the following statement correct?

The width of an element must be set for making filters work.

Answers:

• Yes

• No

40. What is the error in the statement var charConvert = toCharCode('x')?

Answers:

• toCharCode() is a bogus method

• Nothing. It will work fine

• toCharCode accepts only numbers

• toCharCode takes no arguments

41. You are required to create a web page in which hyperlinked sub-headings are displayed. On clicking a link, the contents should get displayed dynamically. Which of the following style attributes would you use for this?

Answers:

• visibility:hidden;

• visibility:display;

• visibility:visible;

• visibility:none;

42. Which of the following will you use for changing the color of a button with id=btn, to green on a mouseover event?

Answers:

• btn.color="green"

• document.getElementById('btn').color="green"

• document.getElementById('btn').style.color="black"

• document.getElementById('btn').style.color="green"

43. You have a button definition as given below:

<input class="a" type="button" value="Calculate">

To load an image "Img2.jpg" as the background of the button on a mouseover event, you can use:

Answers:

• event.srcElement.style.backgroundImage="Img2.jpg"

• event.srcElement.style.Image="Img2.jpg"

• event.srcElement.style.backgroundImage="url('Img2.jpg')"

• event.srcElement.style.Image="url('Img2.jpg')"

44. The anchor tag is defined as follows:

<a href="http://expertrating.com">expertrating</a>

Which of the following styles will increase the spacing between letters on mouseover?

Answers:

• a:hover { spacing: 1px;}

• a:hover { spacing: 2px;}

• a:hover { letter-spacing: 0;}

• a:hover { letter-spacing: 2px;}

45. How will you change the color of the paragraph text to blue on placing the mouse over the paragraph, and reset it back when the mouse leaves the paragraph?

Answers:

• <p onmouseover="style.color='black'" onmouseout="style.color='blue'"> The text of the paragraph..</p>

• <p onmouseover="style.color='blue'" onmouseout="style.color='black'"> The text of the paragraph..</p>

• <p onmouseout="style.color='blue'"> The text of the paragraph..</p>

• <p onmouseover="style.color='blue'"> The text of the paragraph..</p>

46. The form tag is defined as follows:

<form onsubmit="return Validate()" action="http://www.mysite.com/">

How will you implement the Validate() function that will stop the form from being submitted if the name field on the form is not filled?

Answers:

• <script type="text/javascript"> function Validate() { if(document.forms[0].name.value == "") return true; else return false; } </script>

• <script type="text/javascript"> function Validate() { if(document.forms[0].name.value == "") return false; else return true; } </script>

• <script type="text/javascript"> function Validate() { if(document.forms[0].name== "") return false; else return true; } </script>

• <script type="text/javascript"> function Validate() { if(document.forms[0].name == "") return true; else return false; } </script>

47. You are setting cookies with JavaScript. What happens to cookies.txt data if the file exceeds the maximum size?

Answers:

• Your script automatically generates a run-time error

• Your script automatically generates a load-time error

• The file is truncated to the maximum length

• None of the above

48. You are designing a web site and need to set the background image for all the web pages. You want a small background image to repeat and fill up the whole background. Which of the following body styles is ideal for this?

Answers:

• body { background: url(/images/bg.gif); repeat: repeat-x }

• body { background: url(/images/bg.gif); repeat: repeat-y }

• body { background-image: url(/images/bg.gif); background-repeat: no-repeat }

• body { background-image: url(/images/bg.gif);}

49. The following code snippet is used in form validation, the validate function is supposed to return a true if all validations are successful and false if the validation fails. However, the data is always submitted even if the validation fails, what could the cause be?


<form name="frmadd" method="post" action="add.asp" onsubmit="validate()">

Answers:

• There is no error, the code is fine

• There should be a return statement before the call to the validate function

• onsubmit="validate()" should be replaced with "javascript:validate()"

50. What will the following code snippet do?

<form onreset="alert('Please again fill the form')">

Answers:

• It validates the contents of the form

• It prompts the user not to leave the fields of the form empty

• It prompts the user to fill the form once the form is cleared

• None of the above

51. The width of the h4 is defined as follow:

H4 {width:95%;}

How can you make the heading blur?

Answers:

• <h4 filter(blur)>Heading</h42>

• <h4 style="filter:blur()">Heading </h4>

• <h4 style="filter::blur()">Heading </h4>

• <h4 style="Blur()">Heading </h4>

52. You are developing an application and there is a possibility of certain users using older browser versions. You want to hide the JavaScript code in the browsers that do not support JavaScript. How would you do this?

Answers:

• Precede the JavaScript statements with //

• Precede the JavaScript statements with --

• Enclose the statements with /* and */

• Use the following notation: <script language="javascript"> <!-- //--> </script>

• Add a <noscript> tag after the script

53. You declared an array as follows:

var arr;

What value would JavaScript assign to an uninitialized element of this array?

Answers:

• NaN

• null

• undefined

• false

• 0

54. You want to delete an element from an options array. How would you do it?

Answers:

• Set it to false

• Set it to null

• Set it to undefined

• Set it to -1

• Set it to 0

• Set it to 1

55. You want to display an alert that contains a ' (single-quote) character. Which of the following characters would you use to escape the ' character?

Answers:

• *

• \

• /

• _

• #

• %

• |

• ~

56. Which of the following will you use for changing the color of the textbox text with id=txtLocation to blue, on a mouseover event?

Answers:

• txtLocation.color="blue"

• document.getElementById('txtLocation').color="blue"

• document.getElementById('txtLocation').style.color="black"

• document.getElementById('txtLocation').style.color="blue"

57. You have this image definition:

<img id="logo" src="companylogo1.gif" height="12" width="12" >

Which of the following would be helpful for changing the image to "companylogo2.gif" on page load?

Answers:

• logo.source="companylogo2.gif"

• logo.source="companylogo1.gif"

• document.getElementById('logo').src="companylogo1.gif"

• document.getElementById('logo').src="companylogo2.gif"

58. How would you test whether or not a browser window is open?

Answers:

• By using the isOpen method of the window object reference variable

• By using the closed property of the window object reference variable

• By using the open method of the document object

• None of the above

59. What is the default value for z-index?

Answers:

• -1

• 1

• 0

• null

• auto

60. How can you change the image position from  relative to absolute if the image id is "ERImage"?

Answers:

• document.getElementById('ERImage').position="absolute"

• document.getElementById('ERImage').setAttribute(position, "absolute")

• document.getElementById('ERImage').style.position="absolute;"

• document.getElementById('ERImage').style.position="absolute"

61. How would you create a popup window that closes after n seconds?

Answers:

• You cannot program a window to close automatically after n seconds. The user will have to manually close it

• You would use the setTimeout function

• You would use the exit function of the window object

• You would use the terminate function

• None of the above

62. You want to disable the selection of text on the webpage. While trying to select some text, the user should see 'not-allowed' cursor. Which of the following helps you implement this by using JavaScript and IE 5+ browser?

Answers:

• <body onSelectEnd="this.style.cursor='not-allowed'; return true;" onMouseup="this.style.cursor='default'">

• <body onMouseDown="this.style.cursor='default'" onSelectEnd="this.cursor='not-allowed'; return false;">

• <body onSelectStart="this.style.cursor='not-allowed'; return false;" onMouseup="this.style.cursor='default'">

• <body onMouseup="this.style.cursor='not-allowed'; return false;" onSelectStart="this.style.cursor='default'">

63. You are formatting your error messages using the following inline style definition:

<span class="error" style="color: red">Error message.</span>

Now you want the error message text to be displayed in blue color. But the problem is that you are not permitted to edit the HTML code, you can only edit the imported style sheet. Which style definition will you use in the imported style sheet to achieve this?

Answers:

• span.error{color: blue;}

• span.error{ color: blue !important;}

• span.error{ color: blue !inherit;}

• It is impossible. Inline styles always override imported styles

64. While coding a loop, you come across a condition where you have to ignore the rest of the statements and continue with the beginning of the loop. Which of the following statements would you use?

Answers:

• exit

• return

• continue

• while

• break

65. The width of the h4 is defined as follow:

H4 {width:80%;}

How can you make the heading drop shadow?

Answers:

• <h4 filter(shadowdrop)>Heading</h4>

• <h4 style="filter:shadowdrop()">Heading </h4>

• <h4 style="filter:DropShadow()">Heading </h4>

• <h4 style="DropShadow ()">Heading </h4>

• <h4 filter(dropshadow)>Heading</h4>

• <h4 style="filter::shadowdrop()">Heading </h4>

66. You want to validate the value in a field as soon as the user moves out of the field by pressing the tab key. Which of the following events would you use?

Answers:

• onblur

• onfocus

• lostfocus

• gotfocus

• None of the above

67. Which of the following in-built functions is useful when you want to access a form element using its id?

Answers:

• getItem(id)

• getFormElement(id)

• getElementById(id)

• All of the above

68. How would you reduce the image size to half of the original, on an mouseover event, if the original width and height are 100px and the id is logo?

Answers:

• document.getElementById('logo').style.width="50" document.getElementById('logo').style.height="50"

• document.getElementById('logo').style.width="100" document.getElementById('logo').style.height="100"

• document.getElementById('logo').width="50" document.getElementById('logo').height="50"

• document.getElementById('logo').width="100" document.getElementById('logo').height="100"

69. You developed a web page using HTML and style sheets. You defined H4 style in the head tag, imported style sheet, as well as inline. Which of the following style definitions is used when the page is rendered in a browser?

Answers:

• Default browser H4 definition

• External style sheet definition

• Inline style definition

• Style definition in the head tag

70. You want to position a heading at 15 pixels from the left of the page and 20 pixels from the top of the page. The style definition should be:

Answers:

• h2.side{ position:relative; left:15px; top:20px;}

• h2.side{ position:absolute; left:15px; top:20px;}

• h2{ position:relative; left:15px; top:20px;}

• h2{ position:absolute; left:15px; top:20px;}

71. Which of the following statements is incorrect with regard to a style sheet?

Answers:

• Style sheet defines how an HTML element will be displayed

• Internal and external style sheets cannot be used together

• Multiple style definitions will cascade into one

• Same style sheets can be used by many HTML pages

72. Which code will be useful for disabling the right click event in Internet Explorer?

Answers:

• event.button == 2

• event.button == 4

• event.click == 2

• event.click == 4

73. Which of the following is an important parameter of the wave filter?

Answers:

• WaveSize

• Wavelength

• Strength

• All of the above

74. Which of the following helps you import a style sheet named "ssa.css" in the web page?

Answers:

• <a link="stylesheet" url="ssa.css">

• <link rel="stylesheet" type="text/css" href="ssa.css">

• <style name="stylesheet" url="ssa.css">

• <link item="stylesheet" type="text/css" href="ssa.css">

75. How can you use a timer with a function called rearrange()?

Answers:

• tmr=setTimeout("rearrange()",1)

• tmr=Timer(1,"rearrange()")

• tmr=Timer("rearrange()",1)

• tmr=setTimeout(1,"rearrange()")

76. Which of the options is true for the following style, if h2 and h3 will be positioned on the top of each other?

h2{z-index:1;}

h3{z-index:2;}

Answers:

• h2 will be on the top of h3

• h3 will be on the top of h2

• h3 will be on the right of h2

• h2 will be on the right of h3

77. You defined two styles as follows:

td.right {text-align: right}
td.left {text-align: center}

Which of the following is the right way of calling them in an HTML page?

Answers:

• <td class="td.right">Some Text</td>

• <td class="right" class="left">Some Text</td>

• <td class="td.left" class="td.right">Some Text</td>

• <td class="right">Some Text</td>

78. What does the following code snippet do?

<input type="radio" name="r1" value="radio1" onclick="this.checked=false;alert('sorry')">

Answers:

• The code is incorrect

• The code makes it necessary for the user to select the radio button

• The code disables the radio button

• The code displays an alert when the user selects the button

79. You have two images of buttons, one bright and the other one dull. You want to change the dull image into a bright one. Which of the following attributes would you use with the img tag?

Answers:

• onmousedown="this.src='bright.gif'" onmouseup="this.src='dull.gif'"

• onmousedown="bright.gif" onmouseup="dull.gif"

• onmouseup="this.src='bright.gif'" onmousedown="this.src='dull.gif'"

80. Which of the following style properties is used to display only a part of an image?

Answers:

• snap

• clip

• scroll

• visible

• overflow

• size

81. Which of the following event would execute a script once a web page has completely loaded all content?

Answers:

• OnLoad

• OnKeyPress

• OnKeyUp

• onClick

82. You have a function to change the image with id imageID at runtime:

function changeimg(givenImg)
{
document.getElementById('imageID').src=givenImg
}

How would you make the webpage display "image2.gif", only for the time that the user clicks the image?

Answers:

• <img id="imageID" src="image1.gif" width="50" height="60" onmousedown="changeimg(image1.gif)" onmouseup="changeimg(image2.gif)">

• <img id="imageID" src="image1.gif" width="50" height="60" onmousedown="changeimg(image2.gif)" onmouseup="changeimg(image1.gif)">

• <img id="imageID" src="image2.gif" width="50" height="60" onmousedown="changeimg(image1.gif)" onmouseup="changeimg(image2.gif)">

• <img id="imageID" src="image2.gif" width="50" height="60" onmousedown="changeimg(image2.gif)" onmouseup="changeimg(image1.gif)">

83. You are collecting the user's details on a webpage form. The id has to be repeated twice on the form, but you want the user to fill it once only. If the name of the first id is id1 and the second (to be auto filled) is id2, which code will you supply to the onkeyup event of id1?

Answers:

• document.forms[0].id1.value=document.forms[0].id2.value

• document.forms[0].id2.value=document.forms[0].id1.value

• document.id1.value=document.id2.value

• document.id2.value=document.id1.value

84. The following statements show two ways of calling a JavaScript function:

i)onclick = "a()"
ii)onclick="javascript:a()"

a() refers to a function written in JavaScript.

Which of the following statements is correct with regard to the above two statements?

Answers:

• There is no difference between the two statements

• The first statement is incorrect and the second one is correct

85. Sliding menus can be made using DHTML?

Answers:

• True

• False

86. You have defined an image tag as follows:

<img id="ERImage" width="100" height="100" onmouseover="ImageChange()" src="Image1.jpg">

How would you implement ImageChange() function, if the new image to be set for mouseover is Image2.jpg?

Answers:

• document.getElementById('ERImage').src="Image1.jpg"

• document.getElementById('ERImage').src="Image2.jpg"

• document.getElementById('ERImage').style.src="Image1.jpg"

• document.getElementById('ERImage').style.src="Image2.jpg"

87. You are developing a website for children. You want to format the borders of big <td> cells (as mentioned below) for some fun game:

Left Border:double
Right Border:dashed
Top Border:dotted
Bottom Border:solid

Which of the following would be the correct style definition?

Answers:

• border-style:double dotted dashed solid

• border-style:dotted dashed solid double

• border-style:dashed double solid dotted

• border-style:solid double dotted dashed

88. You want to position all the h2 headings on the page at 15 pixels from the left of page and 20 pixels from the top of the page. The style definition should be:

Answers:

• h2.side{ position:relative; left:15px; top:20px;}

• h2.side{ position:absolute; left:15px; top:20px;}

• h2{ position:relative; left:15px; top:20px;}

• h2{ position:absolute; left:15px; top:20px;}

89. How is the following code useful?

function validate(field)
{
var valid="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
var ok="yes";
var temp;

for(var i=0; i < field.value.length; i++)
{

temp="" + field.value.substring(i,i+1)
if(valid.indexOf(temp)=="-1")
{
ok="no";
break;
}
}
if(ok=="no")
{
alert("error");
field.focus();
}
}

Answers:

• It will force a user to enter only numeric values

• It will force a user to enter only alphanumeric values

• It will force a user to enter only character values

• None of the above

90. Which of the following is true?

Answers:

• If onKeyDown returns false, the key-press event is cancelled

• If onKeyPress returns false, the key-down event is cancelled

• If onKeyDown returns false, the key-up event is cancelled

• If onKeyPress returns false, the key-up event is cancelled

91. You have embedded the document.write() method to write some text within a pair of <TD></TD> table tags. On loading the file, you get some garbled junk on the page that should contain the text. What makes this happen?

Answers:

• The browser does not support JavaScript

• You are using an outdated version of the browser

• The browser does not support cookies

• None of the above

92. Which of the following is used to display an image behind the paragraph text?

Answers:

• set negative z-index for the image

• set positive z-index for the image

• set negative z-index for the paragraph

• set positive z-index for the paragraph

• set z-index=0 for the paragraph

• set z-index=0 for the image

93. You have created an object. How can you add a property to the object class?

Answers:

• With the prototype() method

• With the prototype property

• It cannot be done

• With the this object

94. If an image is placed styled with z-index=-1 and a text paragraph is overlapped with it. Which one will come on top?

Answers:

• paragraph

• image

• any of the above

95. What is the default value for overflow property?

Answers:

• scroll

• visible

• hidden

• auto