- What does DNS mean?
Ans: Domain Name Services or Domain Name System
- Identify the parts of this URL:
http://col.cdm.depaul.edu
Ans: http is the protocol, edu is the top-level domain, depaul is the
secondary domain, cdm is the third-level domain, and col is the server
name.
- Describe the steps that a browser must take to request, obtain
and display a web page. Ans:
- User enters requested URL in browser.
- Browser sends request to DNS (domain name services) to get IP address
of server. This could involve multiple hops, including the top-level domain
server for edu, and a second-level domain server like for depaul.edu.
- Browser obtains IP address of server.
- Browser sends request for web page to IP address of server. This is
an HTTP GET request.
- Server sends page back to server. The client IP address was contained
in the request.
- Browser displays the web page.
- Write a JavaScript event handler that randomly displays one of the
images 1.jpg, 2.jpg, or 3.jpg in the image location imgPicture. Ans:
function display( )
{
var n = 1 + Math.floor(3 * Math.random( ));
if (n == 1)
{
document.images.imgPicture.src = 1.jpg;
}
else if (n == 2)
{
document.images.imgPicture.src = 2.jpg;
}
else
{
document.images.imgPicture.src = 3.jpg;
}
}
or
function display( )
{
var n = 1 + Math.floor(3 * Math.random( ));
document.images.imgPicture.src = n + .jpg;
}
- Write a definition for imgPicture. Ans:
<img name=imgPicture />
- Write a body tag that automatically calls the event handler when
the page loads or is refreshed. Ans:
<body onload=display( );>
- Write an external style that sets the size of imgPicture as
1.5in x 1.0in. Ans:
img { width : 1.5in; height : 1.0in; }
- How do you designate a source code comment in (a) HTML, (b) CSS,
(c) JavaScript? Ans:
<!-- This is the HTML source code comment -->
/* This is the CSS comment */
// This is the JavaScript comment.