{"id":1824,"date":"2017-11-22T15:28:53","date_gmt":"2017-11-22T15:28:53","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/?p=1824"},"modified":"2017-11-22T15:31:44","modified_gmt":"2017-11-22T15:31:44","slug":"higher-javascript-mouse-events","status":"publish","type":"post","link":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/2017\/11\/22\/higher-javascript-mouse-events\/","title":{"rendered":"Higher &#8211; Javascript mouse events"},"content":{"rendered":"<p>The code bellow uses mouse events to run a javascript function.<\/p>\n<p>On line 15\u00a0 the onmouseover and onmouseout events are used to call the function on line 6.<\/p>\n<p>Line 7 targets the <strong>swap<\/strong> id and uses the argument passed to replace the image source.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n\r\n&lt;!doctype html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nfunction changeImage(img_src) {\r\ndocument.getElementById(&quot;swap&quot;).src = img_src;\r\n\r\n}\r\n&lt;\/script&gt;\r\n\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;roll over&lt;\/h1&gt;\r\n&lt;img id=&quot;swap&quot; src=&quot;redButton.jpg&quot; onmouseover='changeImage(&quot;blueButton.jpg&quot;)' onmouseout='changeImage(&quot;redButton.jpg&quot;)'&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The code bellow uses mouse events to run a javascript function. On line 15\u00a0 the onmouseover and onmouseout events are used to call the function on line 6. Line 7 targets the swap id and uses the argument passed to replace the image source. &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script type=&quot;text\/javascript&quot;&gt; function changeImage(img_src) { document.getElementById(&quot;swap&quot;).src = &hellip;<\/p>\n","protected":false},"author":32,"featured_media":1386,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17939],"tags":[],"class_list":["post-1824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding"],"jetpack_featured_media_url":"https:\/\/blogs.glowscotland.org.uk\/nl\/public\/ColtnessHS-ComputingScience\/uploads\/sites\/12638\/2016\/09\/Slide4.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/posts\/1824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/users\/32"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/comments?post=1824"}],"version-history":[{"count":5,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/posts\/1824\/revisions"}],"predecessor-version":[{"id":1829,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/posts\/1824\/revisions\/1829"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/media\/1386"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/media?parent=1824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/categories?post=1824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/tags?post=1824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}