JQuery :: Re-establish User Selection In A Div With Designmode=true

Jun 5, 2009

I have a web app where I have created a div to masquerade at a textarea so I can add highlighting according to so rules. I rely on setting designmode=true. After certain amounts of idle time my code grabs the text from the div, which consists of tags and <span> tags and re-generates the html with new spans. The paragraphs and text stay the same. So far so good. But when the div "repaints" the insertion is set to the beginning of the div. I want it to visually stay put, meaning I need to somehow record where it was before nd then restore it afterwards. Problem is, I can't seem to get my head wrapped around how selections (Ranges, etc.) work. I've been googling around for the last day or so and have not yet seen the light.

View 6 Replies


ADVERTISEMENT

Auto Send User If Password Script Is True?

Nov 3, 2010

Let me first say I am not a java programmer but I can follow the tutorials and get some things to work. Here I am trying to create a password protected page, realizing the level of security is not very high.

This page of code, link1.html, will be blank and if the correct password is entered then I want to automatically link to another page, barcs.html.

<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">

[Code]....

View 3 Replies View Related

JQuery :: Unable To Establish A Callback

Apr 12, 2010

Below is the distillation of code with which I am having troubles. The code works, but I am sure that there must be a better way of doing things.

This simple program displays two boxes. When the user mouses over either box, all boxes are returned to their original state, a zIndex of 2 is applied to it, then the box expands partially over the other box. This works fine.

However, I am using setTimeout to coordinate the setting of the zIndex value, which is something that I would think would better be accomplished through a callback. The problem is that I do not know if a called function can take a callback (I have tried without success).[code]...

View 2 Replies View Related

Determine User Selection

Jul 12, 2007

I am trying to pass the slection made by a user to a javscript
function using the onchange event. The problem is I can get the index
but not the actual value. As my list is variable (dependent on a db)
I cannot hard code to a static index. I either need a way to
determine the number of items in a select control or a way to
determine the actual selection made by the user.

Can anyone enlighten me as to the code to determine what option the
user selects?

View 3 Replies View Related

Establish Serial Port Communication Using Script For Webpage?

Apr 6, 2009

I am working on a robot project, that is required to create a website to control the robot via serial port.. The website is plainly html, no linking to database is needed...

I have no idea how and what language to use and can JavaScript communicate with serial port? and how?

View 2 Replies View Related

Save User Selection On Confirm Message Box?

Jun 30, 2009

I have a confirm message box which asks the user whether they wish to take a survey. At the moment the confirm box appears each time the page is loaded. Would there be a way that when the user selects OK to take the survey this is remembered, so when the users next visit the page the box doesn't appear?

View 1 Replies View Related

Displaying And Changing Image - User Selection?

Apr 17, 2011

I have problem, the code cannot operate. The user must select in dropdown list having one display of image every time.

JS code
var sel = document.getElementById("sw");
function f1(){
var imgs = ['chart1.cgi', 'chart2.cgi', 'chart3.cgi', 'chart4.cgi'];
var im = document.getElementById("pic");
im.src = imgs[this.selectedIndex];
}

html code
<img id="pic" src="chart1.cgi" />
<select name="sw" id="sw" onchange = "f1()" >
<option value="s1">what</option>
<option value="s2">whatever 2</option>
<option value="s3">whatever 3</option>
<option value="s4">whatever 4</option>
</select>

View 6 Replies View Related

Wrap A User Selection With Arbitrary Text?

Jun 24, 2011

how to properly add some text content before and after a user's selection?I am working with the TinyMCE editor, and I can get the following from it:

* User's selection as a W3C compatible range
* User's selection as a browser selection object
* User's selection as a node (element) that encompasses the user's selection

I also need the user's selection to remain selected after being wrapped.I've looked all over the web and could find nothing (except running into my OWN previous questions about this).Here's an example of what I'm trying to do:

[URL]

First line is original text, second line a part is selected, third line the selection is wrapped and the selection remains selected.

View 4 Replies View Related

Allow Selection From List If User Select At Least One Checkbox

Apr 14, 2010

How do we use javascript to only allow selection from the list in question 3 to be made IF the user selected at least 1 check box in question 2?
Below is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL]">
<html xmlns="[URL]" xml:lang="en" lang="en">
<head><title> Example </title>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
</head><body><form name="Form"><h1>Survey </h1>
<p> Please take a minute to fill in the form below. </p><ol>
<li> Question 1.</li>
<li> Q2.Which classes have you attended?
<br />
<input type="checkbox" name="attend" id="aerobics" value="aerobics"/>
<label for="aerobics">Aerobics</label>
<br />
<input type="checkbox" name="attend" id="boxing" value="boxing"/>
<label for="boxing">Boxing</label>
<br />
<input type="checkbox" name="attend" id="circuit" value="circuit"/>
<label for="circuit">Circuit Class</label>
<br />
<input type="checkbox" name="attend" id="weight" value="weight"/>
<label for="weight">Weight Training</label>
</li>
<li> Q3. Which of the above classes has been beneficial for you?
(choose one from the list):
<select class="drop" name="dropdown">
<option value="aerobics">Aerobics</option>
<option value="boxing">Boxing</option>
</select></li></ol></form></body></html>

View 1 Replies View Related

Setting Cookie Based On Checkbox Selection By User?

Jul 23, 2005

I've got the following code snippet in a function to set a coockie based on whether or not the user selects a checkbox. Using an alert the cookie text looks fine but when I go to retrieve the values the only one it can find is the value for user. I've a few different things and none of them seem to work. I'm getting the same thing in both IE and Firefox. The only cookie listed is the 'user' with the proper expiration date. Code:

View 1 Replies View Related

TextFields Based On User Selection - Variables And Objects

Apr 10, 2011

I have 3 TextFields, called txtUSD, txtEUR, txtAUS. And a PopupList with the same values, minus the txt part, but I need to form the names of the TextFields to use based on the selection that the user made. So I've done this:

Code:
function btConvert_Click(event){
var amount = document.getElementById("txtAmount").value;
var rates = document.getElementById("lstConvertTo").value;
var from = "txt" + document.getElementById("lstFrom").options[document.getElementById('lstFrom').selectedIndex].text;
var to = "txt" + document.getElementById("lstConvertTo").options[document.getElementById("lstConvertTo").selectedIndex].text;
var curr_from = document.getElementById(from).value;
var curr_to = document.getElementById(to).value;
if(curr_from > curr_to){
amount * rates;
} else {
amount / rates;
} alert(result);
}

But every time I try it I get this error:
Code:
mobile/main.js line 215: Result of expression 'document.getElementById(from)' [null] is not an object.

View 5 Replies View Related

Echo A Variable In A Form Based On User Selection?

Aug 15, 2009

here is part of a form I have:

<select name = "pulmonologist" >
<option selected="" value="">---Select---
<option value="none">None</option>

[code].....

View 1 Replies View Related

Change Form Target Upon User Selection Of Country?

Feb 10, 2010

with the code details as to how this would be possible.

<form method="post" name="validate" action="internet_marketing_and_email_blasting_signup.php" enctype="multipart/form-data" onmouseover="change(event,'../images/submit1.png')"

[code]....

View 14 Replies View Related

JQuery :: Show / Hide Elements Or Remove / Add Elements Based On Radio Selection By User?

Mar 14, 2010

I have a page I am working and I am having some trouble with: I need to show and hide areas based on a radio selection. I initally started using the show / hide feature in Jquery but the problem is the elements need to be removed but then put back if the user selects the radio buttonagain as it has form elements that have validaion on them. The validation is still trying to validate the form elements becuase they are still on the page but just not showing. This is the radio group the user makes the selection from:

<input name="terms_usr" type="radio" id="terms_usr_1" value="1"/>
<label for="terms_usr_1">Credit Card</label>
<input type="radio" name="terms_usr" id="terms_usr_2" value="2"/>
<label for="terms_usr_2">C.O.D</label>

[Code]....

View 3 Replies View Related

JQuery :: Auto-select A Select Box On Postback With User's Selection

Feb 12, 2010

I have a ColdFusion page with a select drop down list. On submit, I'm storing the value in a cfparam and trying to use jQuery to auto select that particular option. Currently I'm using :contains but this is unacceptable because it selects the last item that contains the cfparam.

$("option:contains('<cfoutput>#form.company_type#</cfoutput>')").attr('selected', 'selected');
Is there something like this:
$("option").equals('<cfoutput>#form.company_type#</cfoutput>')").attr('selected', 'selected');

[Code]....

I willconsider other alternatives to accomplishing my objective.

View 1 Replies View Related

How To Update Selection List Contents From A Server Database Based Upon User Data Entry

Jul 23, 2005

I am trying to create a web page in which the contents of one selection list
depends upon which element in another selection list is chosen, but where
the information to populate the first selection list comves from an SQL
database on the web server.

There are a couple of these situations in my application but, for example,
the first list might be a list of counties, and the second list a list of
states/provinces. Obviously the names of counties depend upon which
state/province is chosen, but there are too many possibilities to be able to
embed them within the web page itself. So when the user selects a
state/province I need to go to the server to ask for the list of counties.

I have seen a number of posts that sort of address this issue. For example
it is suggested to use <script src="a URL"/> to ask the server side code to
send up data of type "text/javascript". However the examples do not seem to
address how the server side code would know which state/province the user
had selected.

If there is a web site that addresses this sort of thing, I would appreciate
any pointers.

View 5 Replies View Related

DesignMode Not Working With IE

Jul 23, 2005

I'm trying to build a web page where the user can insert text dinamically. When the user hits a button, a new text box is created and the user can insert text into it.

It's working nice with Firefox 1.0, but it's not working with IE 6.0.2800.1106 (W2K SP4) Code:

View 3 Replies View Related

Document.designMode ?? Is This Possible?

Feb 8, 2007

is it possible to set document.designMode = "on" for an iframe element that is loaded into a page with AJAX? I've been searching for a solution for hours, it can't be set with <body onload=> since the page is already loaded, and window.onload does not work. Any ideas?? The reason i need to do this is because I have a web app that includes a multipage form and the pages of the form are controlled with XmlHttpRequest, i need the iframe element that is loaded to act as a rich text editor.

View 1 Replies View Related

Position Of Cursor In DesignMode?

Jun 23, 2005

I'm creating a text editor in the browser.

If the user presses enter and their cursor is in the middle of a <p>, i want to insert a <br> tag. If their cursor is at the end of the <p> tag's innerHTML, then i want to insert a new <p> tag.

I can insert both tags as I need, but I can't find a way to get the position of the cursor relative to its containing tag (just assuming there's no other markup in the <p>'s innerHTML, so that selection.parentElement() will return the <p> tag).

View 4 Replies View Related

Update Tag Elements In DesignMode?

Apr 11, 2011

In the code below I have an iframe that acts as a WYSIWYG editor. On load a link is loaded inside the iframe. When you click the link a div opens that displays the URL of that link. Upon changing the link inside the DIV I want to update the href tag that I clicked.

I've experimented with pasteHTML/execCommand("inserthtml") however this only updates the link when you select the text before clicking (as opposed to just clicking on the link), otherwise it inserts a whole new link.[code]...

View 1 Replies View Related

DesignMode = 'on' Not Working In Firefox

Apr 20, 2010

I have a few DIVs which contain text, and when the user double clicks on them, I want the DIVs to change into an interface where he can edit that text. So far, I managed to document.createElement and IFRAME and attach it to the DIV successfully. I could only get IFRAME.contentWindow.document.designMode = 'on'; working in IE. Here's the code: ("this" - is the DIV element)

[Code]...

As you probably can see I am also trying to set the DIV's innerHTML (the text, basically) as the editable text inside the IFRAME, but this too is not working.

View 3 Replies View Related

Prevent Cursor From Leaving Div In DesignMode (Mozilla)

Nov 8, 2006

I'm rewriting a cms for Mozilla and it uses designMode. My problem is
that the cursor can leave the editing div-element so the functions
don't work correctly.

How can I prevent the cursor from leaving this html-element?

View 2 Replies View Related

Insert A Youtube Video Into An Iframe With DesignMode?

May 17, 2010

Ok well I am trying to insert a youtube video into an iframe with designMode on so I have been doing":

Code:
iframeDoc.execCommand("inserthtml", false, "<object width='480' height='385'><param name='movie' value='http://www.youtube.com/v/xlTyCymEM9g&hl=en_US&fs=1&'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/xlTyCymEM9g&hl=en_US&fs=1&' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='480' height='385'></embed></object>");

However, it will not show the player at all.

View 2 Replies View Related

Selection-dependant Input Field - When A User Clicks "Other" From The Drop-down Box

Apr 9, 2010

I have a drop-down box which lists manufacturers of computer products. I want it so that when a user clicks "Other" from the drop-down box, a new input field appears below it which asks them to specify an alternative manufacturer.

<select name="cat" id="cat" onchange="setCategories();">
<option value="components">Components</option>
<option value="pcs">Desktop Computers</option>
<option value="laptops">Laptops/Netbooks</option>
<option value="monitors">Monitors</option>
<option value="drives">Internal Drives</option>
[Code]...

I know it is to do with the "onchange" attribute of the manufacturer input field, but I am new to JavaScript and don't know what code is required for the function to do this.

View 9 Replies View Related

JQuery :: Unable To Successfully Add Event Handlers To An Iframe Where DesignMode = "on"?

Oct 12, 2010

I've been able to successfully add event handlers to an iframe where designMode = "on". The scope of these events are at the document of the iframe (contentWindow.document). What I would like to do is actually bind events to elements w/in the document while designMode is on. I have tried various methods like using find(), bind() and or live() but seem to have hit a road block. I have tried the following w/nosuccess. In the examples below .doc() returns the iframe's document.

$('#myiframe').doc().find('li').keypress(fn);
$('#myiframe').doc().find('li').bind('keypress',fn);
$('#myiframe').doc().find('li').live('keypress',fn);

[code]....

View 4 Replies View Related

WYSIWYG - Self Insertion - Create An Iframe With DesignMode On To Enable Editing Of The Frame

Aug 5, 2009

I am trying to create a WYSIWYG editor for my site, but seeing as how every browser gives different results when using the execcommand method, I am trying to do my own insertions instead.

What I would like to do is create an iframe with designMode On to enable editing of the frame, but when someone does a command to bold text, I want to make a method which enters <b>Some Highlighted Text</b> into the frame where the user highlighted so it would appear bold and the source would have the <b> tags.

My issue is I have been unsuccessful in learning how to take the selected text within an iframe and surround it with tags. I was able to accomplish this in Internet Explorer using this code:

Except the resulting text would actually have the <i> tags appear, and the source would be:

Pretty retarded if you ask me since in no way did I want it to convert the tags into entities.

Anyway, if anyone could please direct me to a method in which I can successfully take selected text within the iframe and surround it with HTML tags in such a way that the formatting will actually show.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved