selection

Select HTML from iframe using Javascript / jQuery

戏子无情 提交于 2019-12-12 10:20:01
问题 Following is a javaScript function to get selected content from an iframe function getIframeSelectionText(iframe) { var win = iframe.contentWindow; var doc = win.document; if (win.getSelection) { return win.getSelection(); } else if (doc.selection && doc.selection.createRange) { return doc.selection.createRange(); } } The Sample iframe looks like this: <iframe id="iframeId" type="html" src="__FILE_PATH__" width="100%" height="750px;"></iframe> The implementation looks like: var content =

Excel VBA: How to Extend a Range Given a Current Selection

主宰稳场 提交于 2019-12-12 07:59:30
问题 I want to do something like: E18-(1,1) &":" &E18+(1,1) My intent is to keep the selection of range E18 (value = B) and extend the selection to D16:F20 . If I have a cell's range of E18 and I want to extend the range to D16:F20 , how can I do this? 回答1: Range(Cells(WorksheetFunction.Max(1, Selection.Row - 1), _ WorksheetFunction.Max(1, Selection.Column - 1)), _ Cells(WorksheetFunction.Min(Selection.Worksheet.Rows.Count, _ Selection.Row + 1), _ WorksheetFunction.Min(Selection.Worksheet.Columns

Converting Range or DocumentFragment to string

不打扰是莪最后的温柔 提交于 2019-12-12 07:44:53
问题 Is there a way to get the html string of a JavaScript Range Object in W3C compliant browsers? For example, let us say the user selects the following: Hello <b>World</b> It is possible to get "Hello World" as a string using the Range.toString() method. (In Firefox, it is also possible using the document 's getSelection method.) But I can't seem to find a way to get the inner HTML. After some searching, I've found that the range can be converted to a DocumentFragment Object. But

Efficency of Insertion Sort vs Bubble sort vs Selection sort?

こ雲淡風輕ζ 提交于 2019-12-12 07:24:48
问题 I have written down that Insertion Sort is faster than Selection Sort, which is faster than Bubble Sort, and that their running time for all 3 are O(n^2), but what can I say to compare them with each other? 回答1: You can compare sorting algorithms against the following criteria: Time Complexity (Big-O notation). You should note that best-case, worst-case and average run-time can have different time complexity. For example best-case for Bubble Sort is only O(n), making it faster than Selection

Javascript Ckeditor Get Mouse click position

荒凉一梦 提交于 2019-12-12 04:55:46
问题 I am using Ckeditor View: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="~/Content/ckeditor/ckeditor.js"></script> <input id="insertPattern" type="button" value="insert pattern" /> @Html.TextArea("editor", new { @class = "ckeditor", id = "aboutme" }) Javascript: $(function () { $('input#insertPattern').click(function () { var txtarea = document.getElementById("aboutme"); var selection = txtarea.getSelection().getStartElement().getOuterHtml();

Three Select Boxes Interacting to Yield One Result - HTML, JavaScript or jQuery

主宰稳场 提交于 2019-12-12 04:33:58
问题 I have three select boxes: <select id="one"> <option value="default">Select Product</option> <option value="value-a1">string1</option> <option value="value-a2">string2</option> <option value="value-a3">string3</option> </select> <select id="two"> <option value="default">Select Version</option> <option value="value-b4">string4</option> <option value="value-b5">string5</option> <option value="value-b6">string6</option> </select> <select id="three"> <option value="default">Select Architecture<

Simpliest way to remember DropDown selection?

巧了我就是萌 提交于 2019-12-12 04:33:26
问题 I have; <form method="post" action="search.php"> <select name="country"> <option value="">Select Country</option> <option value="Afghanistan">Afghanistan</option> <option value="Albania">Albania</option> </select> </form> And then in search.php $country = $country query MySQL table for column that's %like% country. I wonder what is the simplest way to remember dropdown selection after someone makes pick up country? 回答1: You want to be using the selected attribute on the option element. If you

Serializing html: placing span elements around selected text while preserving the HTML structure

心不动则不痛 提交于 2019-12-12 04:19:53
问题 I am trying to make a text highlighter where a teacher can select a range of text so that the student can follow along. The text is formatted with HTML so there are <p> , <b> , <em> etc... elements. To highlight the range of text I am wrapping the range in a span element. The issue: https://jsfiddle.net/7fedkobr/1/ Here is a sentence with some HTML markup: <p>The <b>quick</b> brown fox jumps over the <em>lazy</em> dog</p> When I select a word such as 'The' it gets wrapped in a <span> , boom,

Add html tags around highligted text in contenteditable div

百般思念 提交于 2019-12-12 03:54:49
问题 I have a contenteditable div and i would like to add some html tags around highlighted text, after user select the text and click the button.. Here is the sample code. It has some javascript codes but i couldnt make it work as desired. And i played with a lot actually. https://codepen.io/anon/pen/ybzzXZ P.S. I'm going to add , or like html tags after when we solve the how to add html tags around it. Some of that js codes which i found in stackoverflow. function getSelectionText() { var text =

Double Conditioned selection of data in r

只谈情不闲聊 提交于 2019-12-12 02:58:29
问题 I read extensively about selection with condition using function like aggregate or the package pylr but seems ok for my case. I am sure is not difficult to program, but I would like some input. Basically how to start, what's the line of reasoning that you would follow. Thanks for any advice. So my simplified dataset looks like this time.stamp <- c(21.0,21.1,21.2,21.3,21.4) behavior <- c("close", "1", "close","1","close") event_type <- c("start","point","stop","point","start") example <- data