<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic href with Javascript&amp;amp;colon; strange experience in Discussions</title>
    <link>https://connect.mozilla.org/t5/discussions/href-with-javascript-amp-colon-strange-experience/m-p/66391#M23539</link>
    <description>&lt;P&gt;I created a page with a large DIV inside a small one, with a scroll bar. I have added a link that calls Javascript to set the scroll position to 0. I present here sample code with 2 links for the same purpose. With Chrome, both of them work. With Firefox only the first one works. The second has a surprising effect: It wipes out the page and shows a 0.&lt;/P&gt;&lt;P&gt;I would appreciate if someone enlightened could comment what the W3 specification says about href with Javascript in general and about the effect I observe with href2 in Firefox, but not in Chrome.&lt;/P&gt;&lt;P&gt;Here is the sample code:&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;let smallContainer;&lt;BR /&gt;function fOnload() { smallContainer = document.getElementById('smallContainer');&lt;BR /&gt;fSetScrollPos(250);&lt;BR /&gt;}&lt;BR /&gt;function fSetScrollPos(pos) { smallContainer.scrollTop = pos; }&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body onload="fOnload()"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div id="smallContainer" style="width:200px; height:100px; overflow:auto; border:2px; background:yellow;"&amp;gt;&lt;BR /&gt;&amp;lt;div style="width:100px; height:400px; border: 2px solid red; background:green;"&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;p&amp;gt;&amp;lt;a href="javascript&amp;amp;colon;fSetScrollPos(0)"&amp;gt;href1&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;&amp;lt;a href="javascript&amp;amp;colon;smallContainer.scrollTop=0"&amp;gt;href2&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Aug 2024 20:24:26 GMT</pubDate>
    <dc:creator>Ueli</dc:creator>
    <dc:date>2024-08-30T20:24:26Z</dc:date>
    <item>
      <title>href with Javascript&amp;colon; strange experience</title>
      <link>https://connect.mozilla.org/t5/discussions/href-with-javascript-amp-colon-strange-experience/m-p/66391#M23539</link>
      <description>&lt;P&gt;I created a page with a large DIV inside a small one, with a scroll bar. I have added a link that calls Javascript to set the scroll position to 0. I present here sample code with 2 links for the same purpose. With Chrome, both of them work. With Firefox only the first one works. The second has a surprising effect: It wipes out the page and shows a 0.&lt;/P&gt;&lt;P&gt;I would appreciate if someone enlightened could comment what the W3 specification says about href with Javascript in general and about the effect I observe with href2 in Firefox, but not in Chrome.&lt;/P&gt;&lt;P&gt;Here is the sample code:&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;let smallContainer;&lt;BR /&gt;function fOnload() { smallContainer = document.getElementById('smallContainer');&lt;BR /&gt;fSetScrollPos(250);&lt;BR /&gt;}&lt;BR /&gt;function fSetScrollPos(pos) { smallContainer.scrollTop = pos; }&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body onload="fOnload()"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div id="smallContainer" style="width:200px; height:100px; overflow:auto; border:2px; background:yellow;"&amp;gt;&lt;BR /&gt;&amp;lt;div style="width:100px; height:400px; border: 2px solid red; background:green;"&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;p&amp;gt;&amp;lt;a href="javascript&amp;amp;colon;fSetScrollPos(0)"&amp;gt;href1&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;&amp;lt;a href="javascript&amp;amp;colon;smallContainer.scrollTop=0"&amp;gt;href2&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 20:24:26 GMT</pubDate>
      <guid>https://connect.mozilla.org/t5/discussions/href-with-javascript-amp-colon-strange-experience/m-p/66391#M23539</guid>
      <dc:creator>Ueli</dc:creator>
      <dc:date>2024-08-30T20:24:26Z</dc:date>
    </item>
  </channel>
</rss>

