DHTML Test 2015
oDesk • Internet
Programming
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
3. 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
4. For making the text transparent, the mask filter can be used like:
Answers:
• mask(color=#ff00ff)
•
mask(color=#ffffff)
• mask(#ffffff)
• mask(#ff00ff)
5. 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()">
6. 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 } }
7. 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
8. 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
9. DHTML uses a combination of:
Answers:
• HTML
• A scripting language
• Cascading style sheets
• All of the above
84 NOT Answered Yet Test
Questions:
(hold
on, will be updated soon)
10. 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>
11. 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
12. Which of the following is not a JavaScript event?
Answers:
• onabort
• onchange
• onupdate
• onkeydown
13. 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;}
14. Which of the following is not a CSS filter?
Answers:
• alpha
• beta
• xray
• invert
15. 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
16. 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"
17. Which of the following properties of JavaScript is used to store the extra values for DHTML tricks?
Answers:
• DHTML
• HTML
• innerHTML
• outerHTML
18. 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">
19. 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
20. Which of the following can you use to accept user input?
Answers:
• The prompt method
• The alert method
• A form field
• The confirm method
21. 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
22. 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
23. 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">
24. 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;}
25. Which of the following is not considered a part of DHTML?
Answers:
• JavaScript
• CSS
• HTML
• VBScript
• All are part of DHTML
26. 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
27. 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;}
28. 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)];
29. 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;}
30. 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>
31. How will you display text as a superscript?
Answers:
• vertical-align: super
• vertical-align: superscript
• vertical-align: top
• text-align: super
• text-align: superscript
32. 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"
33. 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>
34. 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"
35. 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
36. Is the following statement correct?
The width of an element must be set for making filters work.
Answers:
• Yes
• No
37. 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
38. 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;
39. 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"
40. 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')"
41. 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;}
42. 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>
43. 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>
44. 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
45. 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);}
46. 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()"
47. 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
48. 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>
49. 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
50. 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
51. 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
52. 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
53. 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:
• *
• \
• /
• _
• #
• %
• |
• ~
54. 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"
55. 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"
56. 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
57. What is the default value for z-index?
Answers:
• -1
• 1
• 0
• null
• auto
58. 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"
59. 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
60. 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'">
61. 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
62. 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
63. 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>
64. 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
65. 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
66. 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"
67. 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
68. 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;}
69. 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
70. 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
71. Which of the following is an important parameter of the wave filter?
Answers:
• WaveSize
• Wavelength
• Strength
• All of the above
72. 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">
73. 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()")
74. 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
75. 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>
76. 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
77. 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'"
78. Which of the following style properties is used to display only a part of an image?
Answers:
• snap
• clip
• scroll
• visible
• overflow
• size
79. Which of the following event would execute a script once a web page has completely loaded all content?
Answers:
• OnLoad
• OnKeyPress
• OnKeyUp
• onClick
80. 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)">
81. 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
82. 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
83. Sliding menus can be made using DHTML?
Answers:
• True
• False
84. 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"
85. 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
86. 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;}
87. 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
88. 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
89. 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
90. 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
91. 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
92. 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
93. 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
{ 0 comments... read them below or add one }
Post a Comment