Custom Tags With ExecCommand

Jul 20, 2005

Does anyone know of a way to wrap custom tags around selected text
using execCommand or otherwise?

I am developing a rich text editor for use in a web site and while
there are a few decent ones already floating around I need to
implement a few extra bits of functionality. Specifically tool tips.
Idealy I'd like to wrap custom tags around selected text using
execCommand. Ie "Selected Text" becomes:

"<a title='User inputed tooltip'>Selected Text</a>".

Any ideas?

View 1 Replies


ADVERTISEMENT

IE ExecCommand Inserthtml Workaround - Insert A Youtube Video Into A Content Editable Div With Execcommand Inserthtml

Apr 3, 2011

im working with execCommand and trying to make a function to insert a youtube video into a content editable div with execcommand inserthtml. Now this works with every other browser except, OMG IE. now i am trying to use pasteHTML(), found that some people have gotten it to work, for its part but for some reason it is not working

[Code]....

View 3 Replies View Related

Custom Tags And Elements

Dec 5, 2006

I would like to include extra "hidden" information in a generated HTML page
that can be used by javascript functions.

I realise that most browsers seem to ignore any tags and attributes they
don't understand, but from what I can tell the standards do not allow me to
make up my own tags or attributes as they will fail validation.

is there any standard element name that can be used for such a purpose i.e.
passes validation but never produces any output (and ideally allows nested
elements to be rendered normally too)...

View 10 Replies View Related

Any Way To Replace Custom Tags To Spans?

Oct 24, 2011

I need to replace custom tags to spans. I have:
Code:
<block style="color:blue" class="block01" limit="100">This is a block</block>
I need to fetch the attributes and add them to a span, like:
Code:
<span style="color:blue" class="block01" limit="100">This is a block</span>
There's a few on the page so I need to change all of them some may have many attributes.

View 1 Replies View Related

JQuery :: Selector With Custom Namespace Tags

Dec 9, 2009

I need to get a reference to a tag with a custom namespace, e.g.: <foo:MyTag/>. I've tried $("foo:MyTag") but that doesn't seem to work.

View 5 Replies View Related

Use Custom Tags In Html And Render Data Based On Their Use

Sep 10, 2010

I am trying to find how to use custom tags in html and render data based on their use.

A good example is the joomla <jm:whatever> tag.

I found the following article: [url]

I think it might be outdated though because the behavior:url element does not seem to work. Plus, when I check the style sheet on a joomla site, it doesnt seem to use this method. I think these tags might be xml but I do not know how to render them based on the tag.

For example: <customAbbrv:display src="test.html" label="Test" />

I would want this tag to fire test.html and pass the attribute label which is set to Test.

View 2 Replies View Related

JQuery :: Adding Custom Attribute Tags To HTML Elements

Apr 14, 2010

Here's what I'm trying to do:
1) I get reference to a div that's on my page:
var theDiv = $("#" + divID);
2) Now I want to add a custom attribute tag to it, so for instance I want to add "winWidth" so that the div object now contains "winWidth=" for instance.
3) I want to set winWidth now since it's part of theDiv to a value

I'm not sure how to really do 1 + 2. I need to do this on the fly because some javascript logic later will add these attributes dynamically to the div... outside of what the original div had...I don't care what it had, I know I have it now in a JS variable and now I want to both add some new attributes to the div, and then set them on the fly. I don't need these attributes to be on my page, I just need them added to my div variable reference.

View 3 Replies View Related

ExecCommand

Sep 28, 2006

Can I use execCommand to save just the contents of a textfield as a PHP file on a users computer? I've been searching for an hour and can't figure out how to do it.

View 2 Replies View Related

ExecCommand And InsertUnorderedList

Feb 23, 2005

Is it possible to use the command:

document.execCommand("InsertUnorderedList")

to specify what type of unordered list, or to use css to specify, what type of unordered list you want?

View 2 Replies View Related

Use Of ExecCommand() Function?

Jul 18, 2011

Does anybody know what's the use of the execCommand() function?? Also, is it used to add tags in textboxes??

View 6 Replies View Related

How Can I Restrict ExecCommand('undo') To A <div>?

Jul 23, 2005

I am using IE 6.0. On a page, I have placed a contenteditable div
which I want to use as a Rich Text Area. I am using the execCommand method of
the document to control bold, italics, underlining, and undo for this div.

I have placed an input element on the page to. All but the undo, are
restricted to working only on the div. How can I restrict the undo to
working on only the div?

Below is the complete page so you can see what I am talking about.
Just paste it into an htm file and traverse to it via your browser.
Type something in the div and the input and then try the buttons. Code:

View 3 Replies View Related

ExecCommand Not Working In IE, Fine In FF?

Jul 4, 2010

I'm (experimenting) writing my own RTE in JavaScript, I'm doing pretty good until it comes to the commands, the execCommand method. Here's what I have so far:

function get(editid) {
// IE
if(document.frames[editid].document) return document.frames[editid].document;
else return document.getElementById(editid).contentDocument;
}

[Code]....

The xC (execute command) function is not working! I've tried so much.

View 2 Replies View Related

Remove Link Using Execcommand()?

Oct 8, 2010

I want to remove link. How to do that using execCommand()

View 1 Replies View Related

Problems With ExecCommand On FontName

Aug 17, 2003

I am attempting to write a wysiwyg text editor to use in back-end site administration forms. It's working pretty well, aside from one error: when I hilight a large block of text and change the font, the change only applies to portions of the text selected (which appears to be random portions). Here is the javascript I'm using:

Code:function applyFont() { document.all.rtEditor.focus(); document.execCommand(fontname, false, document.all.fontNameSelector.value);}Where am I going wrong?

View 3 Replies View Related

ExecCommand - HTML Page With One Section Having Editable Content ?

Dec 21, 2010

I'm using an HTML page with one section having editable content. Nothing overly complicated. All other execCommands are working fine, but I cannot get Paste to work. The function is called from this button:

And, here's the Javascript function:

When I use the Copy or Cut buttons the selected text is loaded into the clipboard. If I press Ctrl+V to paste, it works fine. But clicking the Paste button either has no visible effect (if no text is selected) or just deletes any selected text. I've used the Paste command before from VB without any problem, but it's been awhile since I've used JS.

View 1 Replies View Related

Insert A Link Using ExecCommand That Prompts Users For A Title First?

Apr 7, 2009

I am having a problem with my wysiwyg editor for my site, users dont like the fact that you have to select text before you create a link and I was wondering if it was possible to prompt the user to add title text before you use the execCommand('createlink') and use that has the select text that they made from the prompt. Instead of the old way where you must select text first to use execCommand('createlink') to create a link. kind of like Sitepoint's insert link function but instead prompts the user for the title and doesn't insert bbcode but a anchor tag?

View 7 Replies View Related

JQuery :: Unable To Get Toggle Effect Working Having Different Div Tags And Different <a> Tags

Dec 15, 2011

Can't seem to make it work, I have seen many examples but they are all just for 1 div tag. When i trymore than one it doesn't work anymore.The first one works, if i have more than 1 then the other don't work.

using the following jquery
$(document).ready(function(){
$("#toggle-text").click(function () {
var divvalue= this.value;

[Code]....

View 1 Replies View Related

Firefox - Select A Word And Wrap [b] Tags Or [quote] Tags Around It

Dec 28, 2010

I use Firefox and am wondering how to select a word and wrap [b] tags or [quote] tags around it?

View 30 Replies View Related

Input Tags Outside Form Tags ?

Jul 12, 2010

Is it possible to trigger the action of a form with a submit button that's outside the form tags? If so, how should this example be rescripted to make the input tag work outside the form tags?

View 3 Replies View Related

ExecCommand With "CreateLink" Not Working In Firefox But Ok In IE

Sep 10, 2009

I'm using this code I got from an example:

<head>
<TITLE>Creating a link</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function createLink()

[Code]....

It's working ok in IE, but in Firefox (3.5.3 I'm using), I get the following error:

Quote ... uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/america/editora/simple2.html :: createLink :: line 11" data: no]

Line 0 I have googled for this error but seems nobody is having problems with it? Any help much appreciated, I'm a rookie in javascript.

(line 11 is the CreateLink line)

View 3 Replies View Related

IE .execCommand("Copy") Not Working

Nov 26, 2010

For some reason this code to copy to the clipboard isn't working anymore in IE

$("#holdtext").innerText = '#' + $("#check").val() + '#';
Copied = document.getElementById('holdtext').createTextRange();
Copied.execCommand("Copy");

basically nothing is copied to the clipboard

View 4 Replies View Related

Find <a> Tags With <img> Tags In Them?

Jun 25, 2010

I really know nothing about how to code JavaScript (I know what it is and what it does) and I need a script to go in the head of my page and look for all <a> tags that have <img> tags inside of them and add a rel="lightbox" attribute to them.

View 6 Replies View Related

Custom Function

Mar 25, 2006

I have created a function.

function unHide (fieldname)
{
.... not important...
document.form1.fieldname.style.visibility = 'visible'

}

I have a field name called country in a form.
When the onclick="unHide('country')" is used then the above function
does not work
but if i change the following line within the function
document.form1.country.style.visibility = 'visible' then it works.

What am i doing wrong.

View 5 Replies View Related

Resolved Custom Pop Up Box

Aug 8, 2010

I am looking for a custom pop up box, but there is only 3 kinds (Alert, Confirm, Prompt). Neither of those will work.

View 13 Replies View Related

Custom Alert Box

May 9, 2007

I've tested it in most recent versions of IE, FF, Opera, and Safari.

The first parameter is the alert's text, if a second parameter is passed, it is the alert's title, else it will just have "Alert" in the title.

You can fire the function as many times as you like, any alert's thrown after the first will set themselves on top of each other slightly staggered much like the built in alert.

The alert will automatically be placed in a visible place regardless of where the page has scrolled. They will also stay in that same place in relation to the screen if the user scrolls after the alert has fired.

The top most alert is the only one clickable and moveable until it has been acknowledged (Much like a regular alert).

The benefit of this is that it does not freeze the user's interface once the alert is thrown.

Here's the code:

Javascript:

//*****************************
// Custom Alert Box
// Free to use with credits in tact.
// Written By Adam Matthews aka Basscyst
//AdamDMatthews@Gmail.com
//*****************************
function msgBox(msg,hdr){
if(!document.getElementById('alerts')){
var div=document.createElement('div');
div.setAttribute('id','alerts');
document.body.appendChild(div);
}
var div=document.createElement('div');
div.className="alertbox";
var h3=document.createElement('h3');
h3.className="alerttitle";
var p=document.createElement('p');
p.className="alerttxt";
var footdiv=document.createElement('p');
footdiv.className="alertfoot";
div.appendChild(h3);
div.appendChild(p);
div.appendChild(footdiv);
var but=document.createElement('input');
but.setAttribute('type','button');
but.className='alertbut'
but.setAttribute('value','OK');
footdiv.appendChild(but);
var hdr=(hdr) ? hdr : "Alert!";
h3.appendChild(document.createTextNode(hdr));
var cut=msg.split("
");
var len=cut.length;
p.appendChild(document.createTextNode(cut[0]));
for(var i=1;i<len;i++){
p.appendChild(document.createElement('br'));
p.appendChild(document.createTextNode(cut[i]));
}
document.getElementById('alerts').appendChild(div);
window.onscroll=function(){
placeAlerts();
}
window.onresize=function(){
placeAlerts();
}
placeAlerts();
}
var posX;
var posY;
function mouseXY(e){
if (!e){
var e = window.event;
}
if (e.clientX)
{
posX = e.clientX + document.documentElement.scrollLeft;
posY = e.clientY + document.documentElement.scrollTop;
}
else
{
posX = Math.max(e.pageX,0);
posY = Math.max(e.pageY,0);
}
var coord=new Array();
return coord;
}
if(document.captureEvents){
document.captureEvents(Event.MOUSEMOVE)
}
function placeAlerts(){
var alerts=document.getElementById('alerts').getElementsByTagName('div');
var len=alerts.length;
var x=0;
var y=300;
var w=document.body.clientWidth;
var h=document.body.clientHeight;
for(var i=0;i<len;i++){
alerts[i].style.zIndex=i+100;
alerts[i].getElementsByTagName('h3')[0].onmousedown="";
alerts[i].getElementsByTagName('input')[0].onclick="";

if(window.pageYOffset){
alerts[i].style.top=y+(window.pageYOffset)+'px'
}else{
alerts[i].style.top=y+(document.documentElement.scrollTop)+'px'
}
alerts[i].style.left=(w / 2)- (343 / 2) + x +'px';
x=x+15;
y=y+15;
if(i==len-1){
var h3=alerts[i].getElementsByTagName('h3')[0];
var but=alerts[i].getElementsByTagName('input')[0];
but.onclick=function(){
this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
var alerts=document.getElementById('alerts').getElementsByTagName('div');
if(alerts.length==0){
window.onscroll="";
}
placeAlerts();
}
h3.onmousedown=function(event){
this.parentNode.setAttribute('id','active_alert');
var event=(event)?event:arguments[0];
mouseXY(event);
start_x=posX;
start_left=document.getElementById('active_alert').style.left.replace('px','');
adjust=posX-start_left;
document.onmousemove=function(event){
var event=(event)?event:arguments[0];
mouseXY(event);
var obj=document.getElementById('active_alert');
obj.style.left=posX-adjust+'px'
obj.style.top=posY-5+'px'
};
}
h3.onmouseup=function(){
document.onmousemove="";
this.parentNode.setAttribute('id','');
}
}
}
}

Function Call

msgBox("You have done something real bad!
So Bad, oh so bad!","Ya shoudn't of done it boy!")


CSS

.alertbox{
width:344px;
position:absolute;
padding:0px;
margin:0px;
border:solid 1px #FFFFFF;
}
.alerttitle{
background-color:#9B1317;
color:#FFFFFF;
font-size:12px;
width:344px;
cursor:pointer;
text-align:center;
margin:0px;
padding:0px;
}
.alerttxt{
background-color:#E7EFF7;
margin:0px;
font-size:11px;
text-align:center;
padding:0px;
width:344px;
}
.alertfoot{
background-color:#9B1317;
text-align:center;
width:344px;
margin:0px;
padding:0px;
}
.alertbut{
margin-top:2px;
cursor:pointer;
}

View 3 Replies View Related

How Can We Get ChildNodes From A Custom Tag?

Dec 26, 2003

i wrote a very simple HTML page to test some DOM features between Mozilla and IE. Mozilla is perfect everything went fine and i got the childNodes from my custom tag ( this tag i named <blah> ), inside this tag there is two <span>, that i retrieved. But with IE i really could figure out how its done! Code:

View 1 Replies View Related







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