Enclose Selection With Html?

Jul 23, 2005

I am looking for a working replacement
of the following function for Mozilla (this was written for IE):

// encloses the selected area into starting and closing tag
// if no closing tag is given the starting tag will replace the selection
function encloseSelection(startingTag, closingTag)
{
editRange = editArea.document.selection.createRange();

if (closingTag) {
editRange.pasteHTML(startingTag+editRange.htmlText +closingTag);
return;
}

//editRange.collapse(false); // move insertion point to end of text range (append tag)
editRange.pasteHTML(startingTag); // replace selection with startingTag
}

Longer version:
I am working on making an older "WYSIWYMG"-editor (written for IE)
Mozilla-compatible. Everything works fine so far, but I am not able
to figure out a solution to the above problem.

I'd like to enclose a selected text in one of the famous
"designMode=on" iframes with HTML-strings. I've tried numerous
ways - by now without luck.

View 6 Replies


ADVERTISEMENT

JQuery :: Unwanted Selection Of Html Element

Feb 15, 2011

This is probably more of an HTML question than anything else, so my apologies if it's out of place.I'm using a series of spans within a div to act as filters (selectors) to hide/show various divs. When the user clicks on the text within the span, the span toggles a "selected" class, and also triggers a function to hide the associated divs. My problem is that occasionally the area around the text (the entire span, it would seem) gets "selected" when clicked on and turns blue, obscuring the text. Here are two screenshots, one showing the word "lambs" correctly, the other showing the same word with the unwanted blue background. Question: is there any way to make this not happen? Should I be using different elements as the selectors?

View 3 Replies View Related

Selection Html Field And Disabling Stuff

Mar 18, 2011

Got some problems with a php script that outputs a jQuery script.
The purpose of the jQuery code is that when you select an item from the select field that other items need to be disabled(works correct in all conditions) and that at the same time text in corresponding divs' text are altered.The thing is that the script basically works.. however when you've made a selection only the disabling works everytime but the divs are only updated once, so you need to refresh the page if you want to do it again..[code]

View 1 Replies View Related

JQuery :: Raise Event On Certain Text Selection In Html Page?

Mar 11, 2011

suppose i have a html page with text, links and what ever else a page contains. On selection of Text on the html page i want to raise some event that will do something. But what that event is known as? By text selection i mean placing mouse pointer to some text and left clicking and moving the mouse either to left or right. Now when user selects some portion of text and releases the mouse's left click button a event should be raised. Obviously that event should know what was the selected text. So is it possible ?

View 1 Replies View Related

Ajax And Php - Automatically Population A Html Selection Option Based On The Choice Of The Previous

Jan 22, 2010

Not sure if this should have went into the php or javascript forum. I am trying to setup a script that will automatically population a html selection option based on the choice of the previous selection. If hard code everything it will work fine example manufacturer is currently being populated dynamically when the pages loads. The issue is I am can't pass pass the manufacturer variable through to be processed to only retrieve the models for that manufacturer. The code also uses a standard ajax script which httprequest in it.

[Code]....

View 1 Replies View Related

Call Script Function From Iframe.html To Control An Object On Index.html?

Aug 25, 2010

I'm building a webpage using javascript and iframes. Basically I have an iframe in the middle of the index.html page that links to another html page (let's call it iframe.html). My question is, is it possible to call a javascript function from iframe.html to control an object on index.html? If so, how do I do this? I'd like to be able to assign an image in iframe.html with the hyperlink of href="javascript:function()", where the function effects the CSS of a div on index.html.

View 2 Replies View Related

The Page Goes To Index3.html Or Index#.html In A Random Fashion When Refresh

May 16, 2010

I have a web site which main page is index2.html I need a script that when I refresh the page it takes me to index3.html or index#.html in a random fashion. the list of index numbers is 10 so far.

index3
index4
index5
etc etc

View 2 Replies View Related

Manipulating Css Lass And At The Same Time Having A Base Html Statement In My Html File?

Jul 16, 2010

I came across a very odd browser behavior when trying to modify a css class using javascript and at the same time having a base html statement in my html file.Without the base html statement, all browsers work fine and I can change the css class definition using javascript easily.With a base html statement, only FireFox still works while Internet Explorer and Google Chrome dont work anymore. If there is a cross-domain issue, while one browser does work and the others dont? An example of what I'm talking about, with the base statement:

http://freebsdcluster.org/~casaschi/tmp/example-base.html
Without the base statement:
http://freebsdcluster.org/~casaschi/tmp/example-nobase.html

how to tweak the code in the case with the base html statement in order for the javascript to work with all browser (modifying the class definition) ?I want to be able to manipulare css classes with javascript when a base html statement is in my html code.This is essentially the code:

<!--
-->
<base href='http://www.google.com'>
<style id='myStyle' type='text/css'>[code]....

View 10 Replies View Related

.html() Garbles Div Information - If I Alert() The Div Contents With Html() It Seems To Get A Bit Garbled In The Process?

Dec 28, 2010

It appears that .html() is somehow messing up reading the contents of a div.Here is my php code which loads into the div.

$own_pre_selection .= "<input name='" . mysql_result($result,$i,"did") . "' value='" . mysql_result($result,$i,"did") . "' type='hidden'><span class='addremove' onclick="recordchecks('" . mysql_result($result,$i,"dname") . "','" . mysql_result($result,$i,"did") . "')";><u>Remove</u></span>  " . mysql_result($result,$i,"dname") . "<br>";

Here is what I see as source code after the page renders.

<input name='677' value='677' type='hidden'><span class='addremove' onclick="recordchecks('Heart Neoplasms','677')";><u>Remove</u></span>  Heart Neoplasms<br><input name='1298' value='1298' type='hidden'><span class='addremove' onclick="recordchecks('Heart Septal Defects; Atrial','1298')";><u>Remove</u></span>  Heart Septal Defects; Atrial<br></div>

When I test alert() the .html() contents it appears like this. It seems to screw up the quote escape and changes " to " ;="" after the recordchecks().[code]...

So even though the source code looks perfect, if I alert() the div contents with html() it seems to get a bit garbled in the process.

View 2 Replies View Related

Get Values From Form.html(textbox) To Test.html(drop Down List) ?

Feb 6, 2011

I would like to ask how do I get the value from a textbox from form.html which contains my iframe and copy the value into another page, test.html ?

View 2 Replies View Related

Date Selection

Jul 23, 2005

How can i create a date drop menu that automatically have today's date
selected?

View 2 Replies View Related

Document.selection

Jul 23, 2005

function spawn(ev){
var oSelect = ''
var oFlag = false;
if (ns4 || ns6)
oSelect = document.getSelection();
else if (ie4 || ie5){
if (!ev)
ev = window.event;
oFlag = true;
oSelect = document.selection;
}
alert(oSelect.type);
}
if (oSelect == '')
return;
else{
//stuff
}

In Netscape 4.8 if text is not selected nothing happens which is what I want. Please
disregard the fact that oSelect.type is not Netscape compatible you are really
seeing only a partial of what I am doing.

The issue here comes from this page: Code:

View 5 Replies View Related

Selection Object

Jul 23, 2005

I am trying to achieve in Netscape what I can achieve in IE by
document.selection.empty(). This will remove the highlighting created by
Ctrl A or by dragging over text on a page. I can access the selection object
in NS using window.getSelection() but I have not found any way to clear it
so as to remove the highlighting. I have tried the collapse() method but
that does not do it.

View 3 Replies View Related

One Checkbox Selection

Dec 26, 2006

I have 3 checkboxes but the user should select just one. How to block multiple checkbox selection ?

View 1 Replies View Related

Listbox Selection

Mar 27, 2006

I wrote the following code. So when the user presses the button it should select the second item in the list box. Would someone mind helping me fix this code so it works? Code:

View 1 Replies View Related

Copy Same Selection On One To Another

Feb 24, 2011

I have this in query:

That works fine for input:text boxes but doesnt work for dropdown menus.

How to i have the state dropdown to be the same for the other.

View 8 Replies View Related

Picture Selection

Mar 5, 2004

if i have a picture 300x300 px on-line!!!

is there a way to select a piece of that picture where i want like 120x200 and that that piece is showed into new window!!

something like photoshop when i select with the mask!!!
suggestions?

View 5 Replies View Related

Menu Selection

Jun 22, 2004

how i can create the list of menu that when we want to select certain item instead of we must select manually....mayb u all dont understand...ok like this, i want to select item 'cow' in list of cat, dog, cow, deer n etc...so when i press 'c' then the item cat n cow will appear, but i dont want be like that....but i want when i press 'c' the menu list appear as usual then when i press for the 2cd time, i press 'a' only cat will appear in the option list.

View 1 Replies View Related

Blocking Selection

Jul 4, 2005

I want to know is it possible to block user from selecting any text displayed on a webpage? What I want is to block user from selecting anything by mouse drag.

View 5 Replies View Related

Greyout A Selection Box

Sep 5, 2005

I have 3 drop downs for day/month/year ,this basically is for when some
text entered into a textarea is entered expires

However there will be some text that will never expire,so I would like to
place a radio or even a check box that says "never expires", however
when this is ticked I would like the 3 selects for day/month/year to be greyed out, so that they cannot be selected. Is that possible.?

View 22 Replies View Related

Refer To A Selection Box

Mar 17, 2009

I have to add a selection box in my assignment, but I don't know how to refer to it in the javascript.

Here is the javascript code I am trying to refer to the selection box with that doesn't work [code]...

View 7 Replies View Related

Loading Multiple External Html Pages At One Html Page?

Dec 28, 2010

I tried to load 1 html through ajax and javascript and it worked.But i want to load more than one and i cant.I thought that it would be a good idea to put the ajax files to the external websites and put the same load button.I tried this idea but it doesn work.I can only load one external website.

View 2 Replies View Related

File That Generates Web Galleries In Adobe Lightroom - Use History.go To Find Last Instance Of Index.html Or Index_x.html

Jul 3, 2011

I have a file that generates web galleries in Adobe Lightroom. They are generated depending on which files are selected and the metadata in those files.

Basically it is a series of pages of thumbnails called index.html index_1.html index_2.html etc.

Then a set of pages for each individual image.

An example can be seen here: [url](the page navigation links are not great, but I have addressed that, they're at the bottom >> )

Currently if a user clicks on a photo there is a 'return to thumbnails button at the top, but this always takes them to /index.html

So the user could be at a picture after browsing to /index_39.html and still get returned to /index

Is there any way I can use history.go to find the last instance of index.html Or index_x.html (where x is any number) and take them back to that instead?

View 1 Replies View Related

How Do I Copy One Drop Down Selection To Another ...

Jul 23, 2005

I am trying to set the value of one drop down select box to the value of another drop down select box. I have the following in a function.

document.formname.boxto.options[document.formname.boxto.selectedindex].v
alue =
document.formname.boxfrom.options[document.formname.boxfrom.selectedinde
x].value;

but I need to change the above line to allow the 4 references to "boxto" and "boxfrom" to be dynamic so their values can be passed to the function each time. Any ideas?

View 5 Replies View Related

Creating Drop Down Selection Box On The Fly

Jul 23, 2005

I would like to create a box with the same behavior as the "To" field
in the gmail "Compose Email" page.

That is a simple text box but when you start typing it will suddently
show a list of all the e-mails (for our purpose any string would do) in my address
book that have the given substring in it.

E.g. if I type in "ga" I get all the e-mails where the "ga" substing
shows up.

Then I can select from the list and press enter on the requested
address or I can keep typing if the address is not in the list yet.

View 2 Replies View Related

Document.selection.empty()

Aug 5, 2005

Is there a way to achieve in Firefox (and other browsers) what I achieve in
IE6 with the document.selection.empty()? I want to be able to empty the
selection every time the user clicks a certain area, thus making it
impossible to select any text in that area. Is there a way to clear the
text selection in Firefox?

View 3 Replies View Related







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