Page 112 - DCAP512_WAP_AND_WML
P. 112

WAP & WML




                    Notes          <prev/>
                                   </do>
                                   <p>Target:
                                   <img localsrc=”circleslash” alt=”prev” src=”target.gif”/>

                                   </p>
                                   </card>
                                   </wml>
                                   The <img> tag is used to add an image to a WML card. This is the same as in HTML. WAP
                                   browsers will display the text assigned to the alt attribute of the <img> tag if it cannot display
                                   the image for reasons such as file not found or image format not supported. The URL of the
                                   image file is specified with the src attribute.
                                   The height and width attributes of the <img> tag, as their names suggested, are used to specify
                                   the height and width of an image’s display area. WAP browsers may reserve some space on the
                                   screen according to the values of these two attributes when the image is still downloading, so
                                   that users can know the layout of the card.




                                     Notes  Also, WAP browsers may scale up or down the size of an image if the height and
                                     width attribute values are not the same as the image’s real size.

                                   8.1.1 Image Restrictions

                                   Older WAP-enabled wireless devices can only display WBMP images. Newer ones support
                                   image formats commonly used on the web such as GIF, JPG and PNG.


                                          Example: This example demonstrates how to display an image in WML using the <img>
                                   tag:
                                   (imageEg1.wml)

                                   <?xml version=”1.0"?>
                                   <!DOCTYPE  wml  PUBLIC  “-//WAPFORUM//DTD  WML  1.3//EN”  “http://
                                   www.wapforum.org/DTD/wml13.dtd”>

                                   <wml>
                                     <card id=”card1" title=”Image in WML”>
                                       <p>
                                         <img src=”smile.gif” alt=”Smile” height=”62" width=”60" /><br/>

                                         Welcome to our WML tutorial.
                                       </p>
                                     </card>
                                   </wml>







          106                               LOVELY PROFESSIONAL UNIVERSITY
   107   108   109   110   111   112   113   114   115   116   117