{"id":239,"date":"2007-09-18T00:00:00","date_gmt":"2007-09-18T00:00:00","guid":{"rendered":"http:\/\/www.strongd.net\/?p=239"},"modified":"2007-09-18T00:00:00","modified_gmt":"2007-09-18T00:00:00","slug":"Anchor Links in XHTML MP","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=239","title":{"rendered":"Anchor Links in XHTML MP"},"content":{"rendered":"<p><P><FONT class=mainText>Anchor links are used for navigation. You select an anchor link to go to another resource such as an XHTML MP page, or to scroll to a location in the current XHTML MP document. Anchor links are created with the &lt;a&gt;&lt;\/a&gt; tag pair.<\/FONT><\/P><br \/><P><FONT class=mainText>The <I>href<\/I> attribute of the &lt;a&gt; tag is used to specify the URL (Uniform Resource Locator) to the link target. The protocol used is HTTP. A URL has the form:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>http:\/\/host_name\/path\/file_name#offset?parameter1=value1&amp;parameter2=value2&#8230;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>You should be very familiar with it if you have programmed HTML or WML before.<\/FONT><\/P><br \/><P><BR><\/P><br \/><H2><A name=\"18.1.Going to a Location in the Current XHTML MP Page|outline\"><\/A>Going to a Location in the Current XHTML MP Page<\/H2><br \/><DIV><br \/><P><FONT class=mainText>As said earlier, you can make use of an anchor link to scroll to a location in the current XHTML MP page. To do this, first you have to set a link destination (target anchor) within the document. Second, you have to point an anchor link to the destination.<\/FONT><\/P><br \/><P><FONT class=mainText>To set a link destination within an XHTML MP document, the <I>id<\/I> attribute should be used. Most XHTML MP tags contain the <I>id<\/I> attribute. Here are some examples:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;a <B>id=&#8221;<I>destination_id<\/I>&#8220;<\/B>&gt;&lt;\/a&gt;<\/FONT><\/P><br \/><P><FONT class=codeText>&lt;a <B>id=&#8221;<I>destination_id<\/I>&#8220;<\/B> \/&gt;<\/FONT><\/P><br \/><P><FONT class=codeText>&lt;h1 <B>id=&#8221;<I>destination_id<\/I>&#8220;<\/B>&gt;XHTML MP Tutorial&lt;\/h1&gt;<\/FONT><\/P><br \/><P><FONT class=codeText>&lt;p <B>id=&#8221;<\/B><B><I>destination_id<\/I>&#8220;<\/B>&gt;Some text in a paragraph&lt;\/p&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>To point an anchor link to the link destination, you need to construct a URL using the id of the link destination as the offset (Note that an offset begins with the # character), and then specify this URL as the <I>href<\/I> attribute value of the anchor link, like this:<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=codeText>&lt;a href=&#8221;#<I>destination_id<\/I>&#8220;&gt;Select here to go to a location in the current XHTML MP document&lt;\/a&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>As the link destination is in the current XHTML MP document, there is no need to specify the host name, path and file name in the URL. Only the offset is needed.<\/FONT><\/P><br \/><P><FONT class=mainText>The following XHTML MP example demonstrates how to go to a location within the current document:<\/P><br \/><P><FONT class=codeText>&lt;?xml version=&#8221;1.0&#8243;?&gt;<BR>&lt;!DOCTYPE html PUBLIC &#8220;-\/\/WAPFORUM\/\/DTD XHTML Mobile 1.0\/\/EN&#8221; &#8220;http:\/\/www.wapforum.org\/DTD\/xhtml-mobile10.dtd&#8221;&gt;<BR><BR>&lt;html xmlns=&#8221;http:\/\/www.w3.org\/1999\/xhtml&#8221;&gt;<BR>&nbsp;&nbsp;&lt;head&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;XHTML MP Tutorial&lt;\/title&gt;<BR>&nbsp;&nbsp;&lt;\/head&gt;<BR><BR>&nbsp;&nbsp;&lt;body&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;<B>&lt;a id=&#8221;top&#8221;&gt;<\/B>Table of Contents:<B>&lt;\/a&gt;<\/B>&lt;\/p&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Part 1 XHTML MP Introduction&lt;\/li&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Part 2 Development of Wireless Markup Languages&lt;\/li&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Part 3 Advantages of XHTML MP&lt;\/li&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Part 4 WML Features Lost in XHTML MP&lt;\/li&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/ul&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;<B>&lt;a href=&#8221;#top&#8221;&gt;<\/B>Back to top<B>&lt;\/a&gt;<\/B>&lt;\/p&gt;<BR>&nbsp;&nbsp;&lt;\/body&gt;<BR>&lt;\/html&gt;<\/FONT><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>This is the result of the above XHTML MP example in a mobile phone browser:<\/FONT><\/P><br \/><P><br \/><TABLE cellSpacing=0 cellPadding=4 width=\"100%\" border=0><br \/><COLGROUP><br \/><COL width=256><br \/><THEAD><br \/><TR><br \/><TD vAlign=top width=\"100%\"><br \/><P><IMG height=166 src=\"http:\/\/www.developershome.com\/wap\/xhtmlmp\/xhtml_mp_tutorial_html_26625ed.png\" width=134 align=left border=0 name=image46><BR clear=left><FONT class=mainText>Nokia Mobile Browser 4.0<\/FONT><\/P><\/TD><\/TR><\/THEAD><br \/><TBODY><\/TBODY><\/TABLE><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>If you select the &#8220;Back to top&#8221; link, the page will be scrolled to show the text &#8220;Table of Contents&#8221;.<\/FONT><\/P><br \/><P><br \/><TABLE cellSpacing=0 cellPadding=4 width=\"100%\" border=0><br \/><COLGROUP><br \/><COL width=256><br \/><THEAD><br \/><TR><br \/><TD vAlign=top width=\"100%\"><br \/><P><IMG height=166 src=\"http:\/\/www.developershome.com\/wap\/xhtmlmp\/xhtml_mp_tutorial_html_53709779.png\" width=134 align=left border=0 name=image47><BR clear=left><FONT class=mainText>Nokia Mobile Browser 4.0<\/FONT><\/P><\/TD><\/TR><\/THEAD><br \/><TBODY><\/TBODY><\/TABLE><\/P><br \/><P><BR><\/P><br \/><P><FONT class=mainText>For Sony Ericsson mobile phones, going to a link destination in the current XHTML MP page is not supported until browser version 4.0, which is first included in Sony Ericsson Z1010 mobile phones. Hence, earlier mobile phone models such as T610 and T68i do not support this feature.<\/FONT><\/P><\/FONT><\/DIV><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Anchor links are used for navigation. You select an anchor link to go to another resource such as an XHTML MP page, or to scroll to a location in the current XHTML MP document. Anchor links are created with the &lt;a&gt;&lt;\/a&gt; tag pair.The href attribute of the &lt;a&gt; tag is used to specify the URL &hellip; <a href=\"https:\/\/www.strongd.net\/?p=239\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Anchor Links in XHTML MP<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-239","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=239"}],"version-history":[{"count":0,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/239\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}