Dragging Cursor Highlights Text
Jul 23, 2005If I drag the cursor across a page, text and other elements get
selected. Is there anyway to prevent that from happening?
If I drag the cursor across a page, text and other elements get
selected. Is there anyway to prevent that from happening?
I have a div that is draggable using:
<script type="text/javascript">
$( init );
function init() {
[code]....
I am working on implementing a dynamic drag-and-drop sortable jquery to php/mysql function in my app. I am following the tutorial here: [URL] I've got most of it figured out. The only problem is that it is not updating the mysql table correctly. It takes the orderID of the div that was dropped and sets it equal to the spot where it was dropped. As you can guess, that is a problem, because there is already an item with that orderID. So I need a way to grab the ID or even the text of the div that was dropped and pass it to that PHP script. And then I could reorder all the orderID's between the one grabbed and the spot where it was dropped.
Here is the existing Jquery code:
$(function() {
$("#eventBoxes").sortable({ opacity: 0.6, cursor: 'move', update: function() {
var order = $(this).sortable("serialize") + '&action=updateRecordsListings';
$.post("updateDB.php", order, function(theResponse){
[Code]....
Is it possible to click and drag a link (either text or image) to a text field (or something similar) and have it display the URL of the link?
View 1 Replies View RelatedI have 2 example/test pages of the issue I'm experiencing. For now, I'm just trying to get it to work in a standards-compliant browser, so view in something other than ie:
[URL]
If you click and drag the orange bar up or down, it works fine on the first page. However, on the 2nd page, if you click the orange bar and drag down too fast, it starts selecting text and then the bar gets all wacky.
My suspicion is that the bar gets messed up because the text is being selected. That occurs because if you scroll too fast, the cursor goes off the orange slider bar and starts selecting. If you scroll very slowly so that the cursor doesn't go off the bar it seems to scroll fine.
I've tried everything I can think of to stop the text from being selected, but I'm not 100% sure if that's the cause of the problem or just a symptom of something else (maybe bubbling or something?). I tried returning false on every mouse event on the lower panel, tried creating an absolutely-positioned mask above the text in the lower panel, tried removing all text from the lower panel, tried stopPropagation(), etc., but nothing seems to work.
If I set the mousedown/over/move on the lower panel to return false, it prevents selecting text normally by clicking the mouse & dragging, but it will STILL select the text if I click on the slider bar and drag down.
I want to get the cursor start and end position of a selected range in a text-field or text-area. i tried lot of functions in various forums. but when the last character of the selection is a new line character JavaScript ignore it in IE6. any one having idea ?
View 1 Replies View RelatedI have an image map of a subdivision and each section of land in the
subdivision has a lot number on it. Below the image map I have a table
with details about each lot (eg Lot Number, Lot Size, Lot Price
ect...)
I would really like a way so the user can click on the image map and
the corresponding row below the image will be highlighted.
The user clicks on a new row and the previous row goes back to its
original color and the new row is highlighted.
Is the possible? If it is and can someone please point me in the right
direction on how you would do this?
What I am trying to do is exlude the first and last td from a mouseover that highlights the row.
Code:
onMouseOver="this.className='stylehilight';" onMouseOut="this.className='stylehilightreversed';"
I'm aware that above code line does the whole row but I'm not sure how I can exclude tds from a row highlight Current.
Code:
<table align="center" cellpadding="0" cellspacing="0" width="98%">
<tr>
<td class="menuboxleft" align="right"></td>[code]......
I need to create a calandar that highlights the current date.These are the functions, below is the html page.I am sure most of the problem is within the "for loop" script which I have highlighted.
function writeMonth(calendarDay, currentTime) {
document.write("<table class='monthly_table'>");
writeMonthTitle(calendarDay);[code]....
I am using a jQuery plugin whihc highlights fields that are not filled out that are required fields.. Now at the moment it simply displays a "Required field" message, but i want it to highlight the text boxes in red instead, take a look at the link below, hit the submit buton and see what happens.. The styles go all wonky [URL] So can i acheive highlighting the text boxes in red if they are not filled in? I have looked at the documentation and cant seem to work out if it can be done..
View 1 Replies View RelatedCan anyone show me how to select text before or after a cursor in a
textarea or an RTE?
I'm trying to write a function that is similar to the ctrl+f functionality you get in IE, where you have a search string and when you click 'next' the whole string if matched is highlighted by the cursor.
This works fine for inputs and text areas using the following code:
But now I need to get it to work for normal text in a text node that is in the HTML/DOM. Is there an equivalent way of making the above method work for text in text nodes?
Alternatively is there a way to make the browser (IE) at least focus on some text in a text node? (I could then highlight it with CSS styles).
How to add a function that will add some text in textarea, when someone clicks on button, where the cursor is?(Like here, on daniweb textareas!)eg. There is bold button! The user clicks on it, and the text "[BOLD][/BOLD]" writes where curser/caret is. Cursor/caret (|) is focused between these two elements "[BOLD]cursor/caret (|)[/BOLD]"
View 8 Replies View RelatedJavascript is my very weakest, and i'm not all that good..I need to adapt this (already working) code to add the text where the cursor is within the textarea.Like i say, the above code works fine, its just now to get it place where the cursor is within the box.
View 3 Replies View RelatedI need to control the cursor position in a textbox to do this, does anyone know how to place the cursor in the textbox at a particular position
The functionality I am looking for...
Excel provides data entry help based on previous entries i.e. if in a previous cell in a column I entered "Jim Bob" then the next cell I type a "J" Excel provides help by showing "Jim Bob" in a way that allows me to pick it or keep typing. This is the kind of functionality I am trying to get using JS.
In the code below I create an array of previous entries by the user over the last 45 days this all comes from a DB but that's not important here. When the user enters a key in the textbox I can pop the text box with a matching value from the array, only up to the chars entered.
The Problem or Question:
Is there a way to place the curser back into the last position and highlight the remaining part of the match from the array?
This is really hard to explain but if you ever used Excel you may have an idea of what I am trying to do. Code:
Using an onMouseDown, I can determine the coordinates of the cursor. Is there any way to write some text (a string) at that point. I am using at the moment a <textareaa> tag. I want the user to be able to click in the text and at a string to be inserted at that point.
View 1 Replies View RelatedI am using the following code to enter text into text box when it is
empty:
<input name="txt_url" type="text" class="form_text_300" id="txt_url"
onClick="if(this.value == ''){this.value = 'http://'}">
it works fine but when it enters the text - 'http://' - the cursor
jumps back to the start of the line in the text box. How do I then
make the cursor be placed at the end of the text. For example:
http://
here------------------'
http://
and not-------'
I'm using contentEditable divs. I want to have a button a person can press, a modal window appears, some text from the modal window is selected, then it is to be inserted into the contentEditable div in the location the cursor was at before pressing the button. So how can I save that spot so I can insert there?
View 1 Replies View RelatedSup yo, I need to add text in a <textarea>, but i can only append text at the end.
Is there any way to add text to where the cursor is currently at?[code]...
And below i has sum buttonz that uses that function.
So, again, how can I add text to where the I-beam is currently, instead of at the end?
when iam usig java script function to textbox,For text length minimum 4 chars, alert is raising enter minimum 4 chars, but cursor is not focus on text box, when i click on alert "OK".Here the code written.
function min()
{
var len=document.getElementById("tx1").value;[code].....
I'm working on an ajax driven chat room (you can see the "proof of concept" at URL..., and I'm currently working on a function to add color symbols to the chat textbox;As written, function works just great. however, I wish to add the further feature of placing the cursor between the symbols, if the "middle" variable is empty.
View 11 Replies View RelatedI would like to find out the followings:
1) how to set the cursor to a particular textbox depending on the value entered (after the alert message or without alert message)
2) how to make the prg to execute the js function in 2nd textbox (in textbox2row1) if the values changes in textbox1(textbox1row1) but the value in the current textbox(textbox2row1) no change.
I have this:
Code:
<TD WIDTH="99" HEIGHT="41" BACKGROUND="button1DarkWeb.bmp" VALIGN="center" ALIGN="center" rowspan=2
onclick="javascript:formHandlerMainMenu('PrognosticsView.asp');">
<FONT SIZE="+1" COLOR="White">Prognostics</FONT></TD>
It's supposed to be a custom button with centered text in. I cannot include the text in the image and make a bitmap out of it. I have to be able to change the text, and there are lots of different strings.
When the cursor is over the text. It has the shape of a text cursor, not a hand.
Is it possible to make it a hand?
In IE it is a simple matter of: range.text += text; but I am having great difficulty figuring it out for FF.I have looked online for hours but the only solutions that I can find are to do with inserting text into textareas which supply you with nice 'selectionStart', 'selectionEnd' properties. Using a textarea would be useless for my purposes and a div element does not have such properties. An implementation in this case I am thinking would rely solely on the range object for the necesary selection / cursor position information, but I cannot figure out how to do this using the FF/W3C Range object.What I'm basically doing is trying to enable the user to paste unformatted (plain) text into a contenteditable zone for a WYSIWYG editor. I have got it working in IE, but FF is a whole other kettle of fish for this particular issue.
View 1 Replies View RelatedI am currently adding BBCode to my website, and I posted a while ago in this forum for a script that would add tags to my textarea when clicking an BBcode image. But my next problem now is that I need those tags to appear around selected text and at the mouse cursor if no text is selected. Currently all it does is just add the tags at the end of your sentence if you've written something in the textarea. Here is the code I use:
function lolwut(txt)
{
var ta = document.getElementById("my_ta");
ta.value += txt;
}
window.onload = function()
{
lolwut("");
}
I've got a text area called Notes in a form called frmMain.
And I've got a JavaScript function.
Within the JavaScript function what code can I use to move the cursor to the text area field and specifically within that field I'd like the cursor to be exactly 10 characters into the field?