range

safari: get the word under the mouse pointer

Hi, i'm trying to find a clicked word in an onclick event handler. somediv.onclick = function(event) { var w = getClickedWord(event); alert(w) } getClickedWord() uses range.moveToPoint for msie and event.rangeParent/offset for gecko, but Webkit seems to support neither. Any pointers? ...

VBA Copy and paste a range of numbers

Hi There I'm trying to copy and paste a range, to create a 28 by 28 grid of numbers "rotating" the values so that each time the range is pasted into the next column, the range is moves down by one row and the last value "overflows" back to the top of the next row, I've got this far but am stumped on the overflow part (i' relative newbie...

Tinymce IE6+ How can I get a working range?

I've searching forever trying to figure out why IE will not save the current caret position and then reload it. To be descriptive of the situation it works like this: Client wants Tinymce custom built with an ajax image loader that is simplistic in the nature that any "idiot" can upload and set some settings to an image within the text...

Range of Years in JavaScript for a select box

I'm trying to create a dynamic select box in JavaScript with a range of years starting with 'some' year and ending with the current year. Is there anything like Ruby's range class in JavaScript or do I have to loop trough the years using a for loop? Here's what I've come up with though I think it's a bit much considering in Ruby I can ...

Strange behaviour with range.toString()

I want to get back the text that I select in an element using the Range object provided by Mozilla's flavour of javascript. So I do this: //assume that I'm only using Firefox, and there is just one selection var range = window.getSelection().getRangeAt(0); var rangeText = range.toString(); This works OK when the html of the selected ...

How to scan an IP Range C#

How to scan a specific range of IP and also increment it to user defined range.. in like most of the port scanners. but how to increase host bits.. it increases network bits.. ...

Keep text selection when focus changes

I have a normal textbox, and a lightbox with a text input. I want to keep the user's selection in the textbox, even when the user focuses on the lightbox's text input. 1. Select text in normal textbox 2. Toggle lightbox 3. Focus on lightbox input At step 3., the user's text selection is discarded. How can this be prevented? See Googl...

range - how to select new inserted node automatically ?

hi, i have range> newNode = document.createElement("span"); newNode.innerHTML = 'example'; range.insertNode(newNode); i insert new node. is there way, how to automatically select this newNode (as it appears on page, it is not selected) ? thanks. ...

explorer: how to highlight text after using pasteHTML method ?

i replace selected text with pasteHTML method (Pastes HTML text into the given text range, replacing any previous text and HTML elements in the range.) in internet explorer. var ran = Editor.selection.createRange(); ran.pasteHTML('<span style="font-size:20px;">example</span>'); after replacing text, selection dissapears. how to highli...

sql between for DAYSOFWEEK

I have a generalized search where I'm looking up average prices for the various days of the week. The problem is I'm not sure how to ask for an odd range. 1-7 works fine, (monday-sunday), but if the user passes a sunday to a tuesday... ie 7-2 it doesn't work. 1-7 (1,2,3,4,5,6,7) 7-2 (7,1,2) etc. How else can I pass a range that is m...

How to find if range is contained in an array of ranges?

Example business_hours['monday'] = [800..1200, 1300..1700] business_hours['tuesday'] = [900..1100, 1300..1700] ... I then have a bunch of events which occupy some of these intervals, for example event = { start_at: somedatetime, end_at: somedatetime } Iterating over events from a certain date to a certain date, I create another ar...

getSelection() and insertNode -- Javascript Text Selection

Does anyone know how to set the browser selection to a newly / independently created range? I understand how to get the text selection from the browser, and I understand how to create a range, but I don't know how to tell the browser to change the selection to the range I've created. I would have thought it would be something like "setSe...

Restricting an IP if it is between an IP Range.

Ok, it's friday afternoon, and i've had a long week so would appreciate some help! Currently, i have a list of IP ranges, as follows: List<IPRange> ipRanges = new List<IPRange>(); ipRanges.Add(new IPRange { From = "145.36.0.0", To = "145.36.255.255" }); ipRanges.Add(new IPRange { From = "194.183.227.184", To = "194.183.227.191" }); ipR...

A C# Implementation of Number Line

NumberLine line = new NumberLine(); line.AddRange(1, 5); line.AddRange(20, 30); line.CheckRange(10, 25); NumberLine is a class which represents a number line. I want to mark on it different ranges of numbers. The CheckRange method should return which parts from 10-25 I marked and which I did not. In this case it should return that 10-...

SurroundContents on a range spanning multiple tags (getRangeAt problem?)

I have a script that (I think) needs to use surroundContents to wrap the selection area. Doing so allows me to append something, and then reassign the range as the selection. I believe I've narrowed the problem down to a misuse of getRangeAt, but I'm not quite sure how to correct it. Here's the brief bit of code: function getRang...

How do I surroundContents() around a Document Fragment Node?

I may be asking the impossible, but, how do I surroundContents on a document-fragment node? My thoughts (which I'd appreciate feedback on), are as follows: Is the solution to close the fragmentation? If that's it, is there some way to detect if the starting node and ending node don't have opening and closing tags? I'm running into the...

Javascript Highlight Selected Range Button

I'm attempting to create a study tool for a page that allows a user to select any text on the page and click a button. This click then formats the selected text with a yellow background. I can make this work inside of a single tag, but if the range of selection is across multiple tags (for instance, the first LI in an unordered list al...

What is the inclusive range of float and double in Java?

What is the inclusive range of float and double in Java? Why are you not recommended to use float or double for anything where precision is critical? ...

How to declare a range overlaping constraint in PosgreSQL database?

Let's say we are having a table with this definition: range ( id bigint primary key, colourId int references colour(id), smellId int references smell(id), from bigint, to bigint ) This table is actually a reduced view over enormously big table: item ( id bigint primary key, colourId int references colour(id), smellId ...

MySQL ORDER BY optimisation on range

Hello, I'd like MySQL to use the index to sort these rows. SELECT identity_ID FROM identity WHERE identity_modified > 1257140905 ORDER BY identity_modified However, this is using a filesort for sorting (undesirable). Now, if I leave off the ORDER BY clause here, the rows come out sorted simply as a consequence of using the in...