This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pf:prpldocs:vars_and_functions [2016/06/23 13:20] – virgilw | pf:prpldocs:vars_and_functions [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | < | + | < |
+ | <script type=" | ||
+ | function selectText(containerid) { | ||
+ | if (document.selection) { | ||
+ | var range = document.body.createTextRange(); | ||
+ | range.moveToElementText(document.getElementById(containerid)); | ||
+ | range.select(); | ||
+ | } else if (window.getSelection) { | ||
+ | var range = document.createRange(); | ||
+ | range.selectNode(document.getElementById(containerid)); | ||
+ | window.getSelection().addRange(range); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <a href="#" | ||
+ | Save the contents to "Vars and Functions.txt" | ||
+ | |||
+ | <div id="selectable"> | ||
+ | </ | ||
< | < | ||
=CMD | =CMD | ||
Line 183: | Line 202: | ||
</ | </ | ||
< | < | ||
- | |||
- | < | ||
- | <script type=" | ||
- | |||
- | |||
- | // Wait for the page to load first | ||
- | window.onload = function() { | ||
- | |||
- | //Get a reference to the link on the page | ||
- | // with an id of " | ||
- | var a = document.getElementById(" | ||
- | |||
- | //Set code to run when the link is clicked | ||
- | // by assigning a function to " | ||
- | a.onclick = function() { | ||
- | |||
- | // Your code here... | ||
- | |||
- | |||
- | function downloadInnerHtml(filename, | ||
- | var elHtml = document.getElementById(elId).innerHTML; | ||
- | var link = document.createElement(' | ||
- | mimeType = mimeType || ' | ||
- | link.setAttribute(' | ||
- | link.setAttribute(' | ||
- | link.click(); | ||
- | } | ||
- | var fileName = ' | ||
- | downloadInnerHtml(fileName, | ||
- | //If you don't want the link to actually | ||
- | // redirect the browser to another page, then | ||
- | // return false at the end of this block. | ||
- | // Note that this also prevents event bubbling, | ||
- | // which is probably what we want here, but won' | ||
- | // always be the case. | ||
- | return false; | ||
- | } | ||
- | } | ||
- | |||
- | </ | ||
- | |||
- | |||
- | <a id=" | ||
- | |||
- | |||
- | </ |