What code segment should you use?

You are developing a Web application that must support a variety of browser. Your analysis indicates that the majority of users that will access the Web application will use Microsoft Internet Explorer 6.0 and Microsoft Pocket Internet Explorer 4.0. You are creating the header for the Web application. The header will display the Domain.com logo from a file named ck_logo.jpg. You want the logo to appear appropriately on all browsers.
What code segment should you use?

You are developing a Web application that must support a variety of browser. Your analysis indicates that the majority of users that will access the Web application will use Microsoft Internet Explorer 6.0 and Microsoft Pocket Internet Explorer 4.0. You are creating the header for the Web application. The header will display the Domain.com logo from a file named ck_logo.jpg. You want the logo to appear appropriately on all browsers.
What code segment should you use?

A.
<asp:Image ID="ckLogo" Runat="server" IE:ImageUrl="Images/ck_logo.jpg" PIE4:ImageUrl="Images/Small/ck_logo.jpg" />

B.
<asp:Image ID="ckLogo" Runat="server" ImageUrl="Images/ck_logo.jpg" PIE4:ImageUrl="Images/Small/ck_logo.jpg" />

C.
<asp:Image ID="ckLogo" Runat="server" ImageUrl="Images/ck_logo.jpg" /> <asp:Image ID="small_ckLogo" Runat="server"
PIE4:ImageUrl="Images/Small/ck_logo.jpg" />

D.
<asp:Image ID="ckLogo" Runat="server" IE:ImageUrl="Images/ck_logo.jpg" /> <asp:Image ID="small_ckLogo" Runat="server" ImageUrl="Images/Small/ck_logo.jpg" />

Explanation:
You can use adaptive rendering to modify a server control. This allows different browser to render the control differently. To use adaptive rendering, you should prefix the property that must be rendered differently with the ID of that browser. The ID for Microsoft Pocket Internet Explorer 4.0 is PIE4 the ID for Microsoft Internet Explorer 6.0 is IE. However, you should not prefix IE as you would then only have images rendered on Microsoft Internet Explorer 6.0 and Microsoft Pocket Internet Explorer 4.0. By not prefixing one property, that property will become the default and will only be replaced on by the prefixed property Microsoft Pocket Internet Explorer 4.0 browsers.

Incorrect Answers:
A: You need a default image for browsers, such as Opera and Netscape that are not prefixed. In this code you only have images that will be rendered on Microsoft Internet Explorer 6.0 and Microsoft Pocket Internet Explorer 4.0.
C: You need to use only one Image control. If you use to Image controls the control without a prefixed property will be rendered on all browsers. While the Image control with the PIE4 prefix will also be rendered on Microsoft Pocket Internet Explorer 4.0, resulting in two logos.
D: You need to use only one Image control. If you use to Image controls the control without a prefixed property will be rendered on all browsers. While the Image control with the IE prefix will also be rendered on Microsoft Internet Explorer 6.0, resulting in two logos.



Leave a Reply 0

Your email address will not be published. Required fields are marked *