MCQs > IT & Programming > DHTML MCQs > Basic DHTML MCQs

Basic DHTML MCQ

1.

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();
}
}

Answer

Correct Answer: It will force a user to enter only character values

Note: This Question is unanswered, help us to find answer for this one

2.

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

Answer

Correct Answer: OnLoad

Note: This Question is unanswered, help us to find answer for this one

3.

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?

 

Answer

Correct Answer: <td class="right">Some Text</td>

Note: This Question is unanswered, help us to find answer for this one

4.

Which of the following is not a JavaScript event?

Answer

Correct Answer: onmousepress

Note: This Question is unanswered, help us to find answer for this one

5.

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?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

6.

You have a function to change the image with id im…

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?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

7.

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

Answer

Correct Answer: You cannot read the HTTP header information using JavaScript

Note: This Question is unanswered, help us to find answer for this one

8.

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?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

9.

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

Answer

Correct Answer: <span style="background-color:yellow">
<span style="background:yellow">

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

10.

Is the following statement correct?

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

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

11.

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?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

12.

You declared an array as follows:

var arr;

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

Answer

Correct Answer: null

Note: This Question is unanswered, help us to find answer for this one

13.

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

Answer

Correct Answer: clip

Note: This Question is unanswered, help us to find answer for this one

14.

What is the default value for z-index?

Answer

Correct Answer: 0

Note: This Question is unanswered, help us to find answer for this one

15.

Consider the three variables:

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

What does pattern.ignoreCase contain?

Answer

Correct Answer: true

Note: This Question is unanswered, help us to find answer for this one

16.

Which non-standard parameter is required when using the photos.createAlbum method?

Answer

Correct Answer: Name

Note: This Question is unanswered, help us to find answer for this one

17.

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

Answer

Correct Answer: The file is truncated to the maximum length

Note: This Question is unanswered, help us to find answer for this one

18.

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:

Answer

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

Note: This Question is unanswered, help us to find answer for this one

19.

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?

Answer

Correct Answer: The function writing to the new window did not close the document stream

Note: This Question is unanswered, help us to find answer for this one

20.

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>

Answer

Correct Answer: The second code is more efficient as it employs object caching

Note: This Question is unanswered, help us to find answer for this one

21.

The width of the h4 is defined as follow:
H4 {width:95%;}
How can you make the heading blur?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

22.

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

Answer

Correct Answer: randomElement = myStuff[Math.floor(Math.random() * myStuff.length)];

Note: This Question is unanswered, help us to find answer for this one

23.

Which of the following is not a JavaScript event?

Answer

Correct Answer: onupdate

Note: This Question is unanswered, help us to find answer for this one

24.

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

Answer

Correct Answer: a{text-decoration:none}

Note: This Question is unanswered, help us to find answer for this one

25.

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?

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

26.

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

Answer

Correct Answer: The prompt method
A form field
The confirm method

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

27.

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

Answer

Correct Answer: Internal and external style sheets cannot be used together

Note: This Question is unanswered, help us to find answer for this one

28.

You are displaying image thumbnails on a page. Upon clicking a thumbnail, the image is being displayed in its
actual size. You do not want the user to be able to click the thumbnails unless they are completely downloaded.
Which event will you use to prevent the user from clicking on the thumbnails until they are completely
downloaded?

Answer

Correct Answer: OnLoad

Note: This Question is unanswered, help us to find answer for this one

29.

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

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

30.

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

Answer

Correct Answer: Which of the following statements is true with regard to setTimeout()?

Note: This Question is unanswered, help us to find answer for this one

31.

The width of h3 is defined as follow:

H3 {width:100%;}

How can you make the heading glow?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

32.

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

Answer

Correct Answer: innerHTML

Note: This Question is unanswered, help us to find answer for this one

33.

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?

Answer

Correct Answer: document.getElementById('lnk1').style.left="0" document.getElementById('lnk1').style.left="2"

Note: This Question is unanswered, help us to find answer for this one

34.

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?

Answer

Correct Answer: document.getElementById('ERImage').src="Image2.jpg"

Note: This Question is unanswered, help us to find answer for this one

35.

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?

Answer

Correct Answer: visibility:visible;

Note: This Question is unanswered, help us to find answer for this one

36.

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

Answer

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

Note: This Question is unanswered, help us to find answer for this one

37.

Sliding menus can be made using DHTML?

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

38.

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

Answer

Correct Answer: document.getElementById('btn').style.color="green"

Note: This Question is unanswered, help us to find answer for this one

39.

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?

Answer

Correct Answer: Inline style definition

Note: This Question is unanswered, help us to find answer for this one

40.

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 }.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

41.

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

Answer

Correct Answer: set negative z-index for the image

Note: This Question is unanswered, help us to find answer for this one

42.

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

Answer

Correct Answer: tmr=setTimeout("rearrange()",1)

Note: This Question is unanswered, help us to find answer for this one

43.

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

Answer

Correct Answer: VBScript

Note: This Question is unanswered, help us to find answer for this one

44.

DHTML uses a combination of:

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

45.

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

Answer

Correct Answer: document.getElementById('txtLocation').style.color="blue"

Note: This Question is unanswered, help us to find answer for this one

46.

A DHTML page contains a table in between some text. You want to shift the table 20 pixels on the right to separate it from text. Which of the following styles would be suitable for the purpose?

Answer

Correct Answer: position:relative; left:20PX;
position:relative; right:-20PX;

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

47.

The width of the h4 is defined as follow:

 H4 {width:80%;}

 How can you make the heading drop shadow?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

48.

Which of the following styles will be helpful in keeping an image at a fixed position on the webpage, even if someone scrolls the page?

Answer

Correct Answer: background-attachment:fixed;

Note: This Question is unanswered, help us to find answer for this one

49.

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?

Answer

Correct Answer: span.error{ color: blue !important;}

Note: This Question is unanswered, help us to find answer for this one

50.

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

Answer

Correct Answer: getElementById(id)

Note: This Question is unanswered, help us to find answer for this one

51.

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

Answer

Correct Answer: None of the above

Note: This Question is unanswered, help us to find answer for this one

52.

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

Answer

Correct Answer: Strength

Note: This Question is unanswered, help us to find answer for this one

53.

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?

Answer

Correct Answer: a:hover { letter-spacing: 2px;}

Note: This Question is unanswered, help us to find answer for this one

54.

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?

Answer

Correct Answer: The browser does not support JavaScript

Note: This Question is unanswered, help us to find answer for this one

55.

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?

Answer

Correct Answer: continue

Note: This Question is unanswered, help us to find answer for this one

56.

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

Answer

Correct Answer: You would use the setTimeout function

Note: This Question is unanswered, help us to find answer for this one

57.

Which of the following is true? 

Answer

Correct Answer: If onKeyDown returns false, the key-press event is cancelled

Note: This Question is unanswered, help us to find answer for this one

58.

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?

Answer

Correct Answer: onblur

Note: This Question is unanswered, help us to find answer for this one

59.

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

Answer

Correct Answer: mask(color=#ffffff)

Note: This Question is unanswered, help us to find answer for this one

60.

Given below is a window.open function:

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

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

Answer

Correct Answer: By keeping the second attribute name same

Note: This Question is unanswered, help us to find answer for this one

61.

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

Answer

Correct Answer: <link rel="stylesheet" type="text/css" href="ssa.css">

Note: This Question is unanswered, help us to find answer for this one

62.

Which of the following is not a CSS filter?

Answer

Correct Answer: beta

Note: This Question is unanswered, help us to find answer for this one

63.

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

Answer

Correct Answer: With the prototype property

Note: This Question is unanswered, help us to find answer for this one

64.

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

Answer

Correct Answer: event.button == 2

Note: This Question is unanswered, help us to find answer for this one

65.

What is the default value for overflow property?

Answer

Correct Answer: visible

Note: This Question is unanswered, help us to find answer for this one

66.

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?

Answer

Correct Answer: document.getElementById('logo').src="companylogo2.gif"

Note: This Question is unanswered, help us to find answer for this one

67.

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

Answer

Correct Answer: By using the closed property of the window object reference variable
By using the closed property of the window object reference variable

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

68.

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

Answer

Correct Answer: p{ position:relative; left:30px;}

Note: This Question is unanswered, help us to find answer for this one

69.

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?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

70.

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?

Answer

Correct Answer: document.getElementById('logo').width="200" document.getElementById('logo').height="200"
document.getElementById('logo').width="200" document.getElementById('logo').height="200"

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

71.

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

Answer

Correct Answer: toCharCode() is a bogus method

Note: This Question is unanswered, help us to find answer for this one

72.

Consider the following JavaScript alert:

<script type="text/javascript">
function message()
{
alert("Welcome to E-Business!!!")
}
</script>

You want the user to see the above message upon opening the page, how will you implement this?

Answer

Correct Answer: <body onload="message()">

Note: This Question is unanswered, help us to find answer for this one

73.

Which of the following is not a JavaScript event?

Answer

Correct Answer: onblink

Note: This Question is unanswered, help us to find answer for this one

74.

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? 

Answer

Correct Answer: Add 'return false' to onsubmit="..." in the FORM tag

Note: This Question is unanswered, help us to find answer for this one

75.

Which of the following code snippets is more effective? Why is it so?

<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>

Answer

Correct Answer: The second code is more effective as it employs object caching

Note: This Question is unanswered, help us to find answer for this one

76.

What will the following code snippet do?

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

Answer

Correct Answer: None of the above

Note: This Question is unanswered, help us to find answer for this one

77.

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?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

78.

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

Answer

Correct Answer: document.getElementById('ERImage').style.position="relative"

Note: This Question is unanswered, help us to find answer for this one

79.

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

Answer

Correct Answer: \

Note: This Question is unanswered, help us to find answer for this one

80.

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

Answer

Correct Answer: The display property sets how an element is displayed

Note: This Question is unanswered, help us to find answer for this one

81.

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?

Answer

Correct Answer: onmousedown="this.src='bright.gif'" onmouseup="this.src='dull.gif'"

Note: This Question is unanswered, help us to find answer for this one

82.

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

Answer

Correct Answer: Set it to null

Note: This Question is unanswered, help us to find answer for this one

83.

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?

Answer

Correct Answer: There is no difference between the two statements

Note: This Question is unanswered, help us to find answer for this one

84.

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;}

Answer

Correct Answer: h3 will be on the top of h2

Note: This Question is unanswered, help us to find answer for this one

85.

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?

Answer

Correct Answer: <input name=txtId type="text" onblur="return ValidateField()">

Note: This Question is unanswered, help us to find answer for this one

86.

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?

Answer

Correct Answer: border-style:dotted dashed solid double

Note: This Question is unanswered, help us to find answer for this one

87.

When does the load event of the browser occur?

Answer

Correct Answer: When the browser receives all the page information, including framesets and displays it

Note: This Question is unanswered, help us to find answer for this one

88.

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?

Answer

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

Note: This Question is unanswered, help us to find answer for this one

89.

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

Answer

Correct Answer: paragraph

Note: This Question is unanswered, help us to find answer for this one

90.

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()">

Answer

Correct Answer: There should be a return statement before the call to the validate function

Note: This Question is unanswered, help us to find answer for this one

91.

What does the code snippet do?  <input type='radio' name='r1' value='adio1' onclick='this.checked=false;alert('sorry')'>

Answer

Correct Answer: clip

Note: This Question is unanswered, help us to find answer for this one

92.

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:

Answer

Correct Answer: event.srcElement.style.backgroundImage="url('Img2.jpg')"

Note: This Question is unanswered, help us to find answer for this one

93.

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?

Answer

Correct Answer: a:hover { text-transform:uppercase;}

Note: This Question is unanswered, help us to find answer for this one

94.

How will you display text as a superscript?

Answer

Correct Answer: vertical-align: super

Note: This Question is unanswered, help us to find answer for this one

95.

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?

Answer

Correct Answer: Use externally linked files which hold the JavaScript code

Note: This Question is unanswered, help us to find answer for this one

96.

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

Answer

Correct Answer: window.location.href

Note: This Question is unanswered, help us to find answer for this one

97.

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?

Answer

Correct Answer: document.forms[0].id1.value=document.forms[0].id2.value

Note: This Question is unanswered, help us to find answer for this one

98.

Which of the following helps you make the text color change to green on moving the mouse over the text?

Answer

Correct Answer: a:hover {color: green;}
a:hover {color: green;}

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

99. Which of the following tags checks the nested body content of a tag and determine whether the specified value is an appropriate substring of the requested variable?

Answer

Correct Answer: <logic>

Note: This Question is unanswered, help us to find answer for this one

100. Which property Removes empty Text nodes, and joins adjacent nodes?

Answer

Correct Answer: document.normalize()

Note: This Question is unanswered, help us to find answer for this one

101. What is the color of “Rainbow” in the following code? <style> div {color:blue !important;} </style> <div id="id" color="green" style="color:red !important;">Rainbow</div> <script> document.getElementById('id').style.color = 'yellow !important'; </script>

Answer

Correct Answer: red

Note: This Question is unanswered, help us to find answer for this one

102. Which of the following is TRUE about replaceChild(Node1, Node2)?

Answer

Correct Answer: Replace Node2 with Node1

Note: This Question is unanswered, help us to find answer for this one

103. Which of the following has the higest priority in CSS?

Answer

Correct Answer: user defined

Note: This Question is unanswered, help us to find answer for this one

104. What does document.body.nodeType returns?

Answer

Correct Answer: 1

Note: This Question is unanswered, help us to find answer for this one

105. Which of the following attributes is not involved in layer?

Answer

Correct Answer: align

Note: This Question is unanswered, help us to find answer for this one

106. Which of the following is not a DOM Event Property?

Answer

Correct Answer: name

Note: This Question is unanswered, help us to find answer for this one

107. What is the correct way to access a parent node?

Answer

Correct Answer: element.parentNode

Note: This Question is unanswered, help us to find answer for this one

108. Which of the following function is used for restricting events to propogate to parent in IE?

Answer

Correct Answer: window.event.cancelBubble

Note: This Question is unanswered, help us to find answer for this one

109. What is the event name which gets triggered when the submit button is pressed on the form?

Answer

Correct Answer: onClick

Note: This Question is unanswered, help us to find answer for this one

110. Which of the following is TRUE about cancelling event bubbling and event default action?

Answer

Correct Answer: Canceling an event's bubbling doesn't cancel its default action

Note: This Question is unanswered, help us to find answer for this one

111. Which of the follow link will trigger an alert message that displays ‘myID’?

Answer

Correct Answer: <a id="myID" href="#" onclick="myFunc(this)" />click</a>

Note: This Question is unanswered, help us to find answer for this one

112. What is the difference between DOM Node and Element?

Answer

Correct Answer: Node is the parent type of Element

Note: This Question is unanswered, help us to find answer for this one

113. What is the color of “Rainbow” in the following code? <style> div {color:blue;} </style> <script> document.getElementById('id').style.color = 'yellow'; </script> <div id="id" color="green" style="color:red;">Rainbow</div>

Answer

Correct Answer: red

Note: This Question is unanswered, help us to find answer for this one

114. What does element.childNodes return?

Answer

Correct Answer: a nodeList of child nodes

Note: This Question is unanswered, help us to find answer for this one

115. What does the Node.nodeType property returns?

Answer

Correct Answer: an integer representing the type of the node

Note: This Question is unanswered, help us to find answer for this one

116. Which of the following code will flicker the text?

Answer

Correct Answer: <div id='flicker'>Flicker</div> <script> function toggle() { setInterval(function() { var elm = document.getElementById('flicker'); if (elm.style.display == 'none&

Note: This Question is unanswered, help us to find answer for this one

117. True or False. The appendChild() method can be used to move an element from one element to another.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

118. Which of the following is FALSE about addEventListener?

Answer

Correct Answer: The first argument accepts the function to occur on the event

Note: This Question is unanswered, help us to find answer for this one

119. Which of the following is an INVALID method for accessing HTML attributes using the DOM?

Answer

Correct Answer: addAttribute()

Note: This Question is unanswered, help us to find answer for this one

120. Which of the following is FALSE about SPAN?

Answer

Correct Answer: SPAN has ALIGN attribute in it

Note: This Question is unanswered, help us to find answer for this one

121. Which of the following is a valid way to restrict autocomplete of a form?

Answer

Correct Answer: autocomplete=”off”

Note: This Question is unanswered, help us to find answer for this one

122. What is the difference between font-size and fontSize?

Answer

Correct Answer: font-size is a CSS property and fontSize is a DOM attribute

Note: This Question is unanswered, help us to find answer for this one

123. Which of the following is TRUE about function : document.addEventListener("DOMContentLoaded", testFunc, false)?

Answer

Correct Answer: The function testFunc() will run as soon as the DOM for the document has fully initialized

Note: This Question is unanswered, help us to find answer for this one

124. Which DHTML technology does the following code utilize? document.getElementById('id').style.color = 'blue';

Answer

Correct Answer: JavaScript, DOM and CSS

Note: This Question is unanswered, help us to find answer for this one

125. Which of the following tags can be used to refer a .css file in a web page?

Answer

Correct Answer: <link>

Note: This Question is unanswered, help us to find answer for this one

126. Which of the following is TRUE about appendChild(newNode)?

Answer

Correct Answer: It inserts the new node to the end of the list of children of the node

Note: This Question is unanswered, help us to find answer for this one

127. Which of the following is TRUE about code written in <% %>?

Answer

Correct Answer: It is treated as server side code in scripting languages

Note: This Question is unanswered, help us to find answer for this one

128. Which of the following code will display the text “Invisible Man”? <div id="name" class="person">The Invisible Man</div>

Answer

Correct Answer: All three codes will not display the text “Invisible Man”

Note: This Question is unanswered, help us to find answer for this one

129. What does document.getElementById("intro") function returns if "intro" does not exist?

Answer

Correct Answer: Returns null

Note: This Question is unanswered, help us to find answer for this one

130. Which of the following is true about the function : object.addEventListener(click, doThis, capture)?

Answer

Correct Answer: capture = "true" will cause doThis() to be executed when onClick() event is detected at the capture phase

Note: This Question is unanswered, help us to find answer for this one

131. Which of the following is TRUE about code written in <%= %>?

Answer

Correct Answer: It is used for accessing any server side variable into the HTML (in .aspx) page

Note: This Question is unanswered, help us to find answer for this one

search
DHTML Subjects