DOM Range - Ability To Add Custom BBCodes?

Dec 22, 2010

First of all, I am not a student and this is not homework. Secondly, I've been programming in C, Motorola assembler, Intel assembler and even GWBasic for years. I recently (this year) got into Web / Javascript / PHP / HTML programming and I'm clawing up the learning curve. I know a fair amount, but have a long way to go. I've been trying to integrate a WYSIWYG editor (TinyMCE) into a bulletin board software package (PHPBB3). All is working well except for one big stumbling block that I've been battling for the past MONTH!...: I want to support the original BBCode system of PHPBB3 (mostly because of the ability for the admin to add custom BBCodes).

So, what I need to do is this:
(1) Select a range of text.
(2) Either REPLACE it with "selection" or else INSERT "" before and "" after.
(3) Lastly, the original selection must remain selected so that additional BBCodes can be wrapped without the need to re-select.

The purpose of (3) is, say, the user clicks "bold" and "italic" and "underline".... all they should have to do is click those 3, not re-select each time. I've tried doing this:
(1) get the selection range
(2) get the selection text
(3) delete the range contents
(4) create two "contextual fragments" (one for the opening tag, the other for the closing tag).
(5) create a <span> element containing the selection text
(6) Insert it all into the range with range.insertNode()
(7) finally select the new span element

This seems to work fine, but Internet Explorer : fails (it complains when I try to get the selection range).

View 9 Replies


ADVERTISEMENT

Validating Date Range - Validate Two A Date Range?

May 24, 2010

I want to validate two a date range using javascript, so that my program would check startdate less than end date. The below function only check the year, and it works.

[Code]...

View 7 Replies View Related

Ability To Refer To Function By Variable

Mar 26, 2010

I have a function that sets a value of this.name. If I call a function of that function (is there a better term for that?), I can get the value of that name with this.name. However, if I save that function's function as a variable, and THEN call it, this.name is undefined.

I don't think my vocabulary is clear enough, so here's my example:
function Ninja(name){
this._name = name;
this.getName = function(){
return "ninja "+this._name
}}

sam = new Ninja("sam");
assert( sam.getName() == "ninja sam", "Ninja's name is ninja sam" );
sam2 = new Ninja("sam2");
sam2getName = sam2.getName;
assert( sam2getName() == "ninja sam2", "Ninja 2's name is ninja sam2" ); //fails
log("Ninja 2's name is actually "+sam2getName()) // actually "ninja undefined"

(Note: Use of "ninja" and assertions are because I was playing with the code in John Resig's java runner thingie: [URL]). The reason I want to be able to refer to a function by a variable is because I want to pass the function to something else that requires a function to be passed in, such as an ajax callback or something. Anyway... why is this.name undefined in the second example?

View 7 Replies View Related

Summary Of Checkbox Values With Recalc Ability?

Jan 18, 2010

I have a pricing page that is broken into multiple categories per phase. I want a customer to be able to select my checkboxes and hit a button that will display a rolled up total. I also want it to be able to re-calculate the totals if a box is subsequently unchecked. I have browsed and searched the form to get the code to where it is now but need help to finish it.

View 10 Replies View Related

Ajax :: Ability To Link Directly To Specific Tab

Mar 11, 2010

I am currently using this template by flowplayer.org: [URL]. The functionality I need is the ability to link directly to a specific ajax tab (i.e. Seagram Building, Barcelona Pavilion, New National Gallery). As of now they are just line items without any anchor tags.

View 9 Replies View Related

Enable The Ability To Always Delete <li> Elements When They're Clicked?

Mar 1, 2011

I want to enable the ability to always delete <li> elements when they're clicked. I can't add id's or onclick functions to each <li> because each one is made using document.createElement("li"); So my question is, how can I make a script that easily allows users to delete a <li> element just by clicking on it.

View 6 Replies View Related

JQuery :: Ability To Access 'data' Attributes Without Having To Use .attr()?

Dec 27, 2011

I make use of new HTML5 data attributes to attach data to DOM elements like so:<div class="foo" data-randomdata="bar">jQuery is awesome.</div> It would be nice to have a specific method to accessing the attributes without having to use the .attr() method like this: var foo = $('div').attr('data-randomdata'); It would be nice for it to work something like this: var foo = $('div').DOMdata('randomdata'); //equals bar

View 1 Replies View Related

JQuery :: Lose The Ability To Resize A Div After Setting InnerHTML?

Jan 22, 2011

I've got resizable divs:

$(document).ready(function() {
$
(".draggit").resizable({

[code]....

View 3 Replies View Related

Create An Order With The Ability To Dynamically Self Total The Sum Of The Selected Items?

Aug 7, 2011

I am trying to create an order with the ability to dynamically self total the sum of the selected items but also be able to add a 25% labor fee having it be at least $90.So if someone buys $300 worth of items the labor charge would be $75 but it would be automatically bumped to $90.heres the existing code:

* Calculates the payment total with quantites
* @param {Object} prices
*/[code].....

View 1 Replies View Related

Images Works In IE But The Other Functions Don't - Use The Span Tag And Work With The InnerHTML Ability?

Mar 1, 2011

Everything works in firefox but only the card switch function works in IE

[Code]...

View 2 Replies View Related

Dynamic Form Creation - Ability To Enter Into Text Field

Dec 6, 2010

A while back, I an working on dynamic form creation. I wanted a user to be able to enter into a text field how many designs he or she would like, then, based on that number, be provided with a pair of text boxes that asked 1) name of design 2) quantity of that particular design. I received this cool way of doing it by user thraddash:

<head>
<script type="text/javascript">
function BuildFormFields($amount){
var
$container = document.getElementById('FormFields'),
$item, $field, $i;

$container.innerHTML = '';
for ($i = 0; $i < $amount; $i++) {
$item = document.createElement('div');
$item.style.margin = '3px';

$field = document.createElement('span');
$field.innerHTML = 'Name of Design';
$field.style.marginRight = '10px';
$item.appendChild($field); .....

As a followup, I wonder how to control in a table where each of these text boxes will appear.

View 8 Replies View Related

Call An ID Range

Jul 20, 2006

let say i have an id range Ie. test1, test2, test3 ... How do i call all of them at a time ? I cant use getElementbyId for sure ... Anyone has any clues?

View 3 Replies View Related

Use Of Normalize And Range?

Feb 25, 2009

I insert text at the text cursor in a contentEditable div. I then have 2 adjacent text nodes so I want to normalize them so there is only 1. The problem is that after I normalize I lose focus on the div and my [text] cursor position. Is there a way around this? How can I save my cursor position and go back to it after I normalize?

View 5 Replies View Related

Date Function Range

Jul 23, 2005

After reading section 15.9.1.1 the ECMAScript Language Specifications I
see that the date range for the Date function is +/- 100,000,000 days
from 01 Jan 1970. This is called an extrapolated Gregorian calendar.
Since the Gregorian calendar did not begin until 15 Oct 1582 what is
the purpose of dates before that date? Wouldn't any computation prior
to that date be meaningless or am I missing something?

The reason I ask is that I have created a date calculator at my web
site. I don't want it to do computations with dates that have no
meaning.

Columbus discovered america on 12 Oct 1492. This must have been with
the Julian Calendar. If I used the Date function to see how many days
it was from that date until now would it be correct?

View 5 Replies View Related

JQuery :: Select A Range Of Id's?

Sep 21, 2010

What would be the best way to apply a class to a range of elements. For instance the user selects a box with the id of 'day_50', they then select another box with id 'day_70'. I need to apply a class to all boxes with the id between and including 50 - 70?

View 9 Replies View Related

Keep Dates Within Specific Range?

Nov 3, 2010

I have to do validation on a form for 2 dates(StartDate and EndDate)the dates cannot be more than four months apart if they are an alert must be displayed. In other words Nov 2009 till March 2010 or May 2009 till September 2009 should be invalid regardless of the day of the month Simply 2 input boxes(StartDate and EndDate) and a submit I've got the other parts of my page worked out just this has me stumped

View 4 Replies View Related

Range Validation For Changing Value?

Jun 8, 2011

what is the right syntax to use for field that carry hidden value same as autoincrement value in db. The form was able to add n delete this value from db make it the hidden value keep changing. it is possible to check range validation for the value?

in this case the hidden value is sid.

How to correct the line below? --> var chkVal = theForm.("score1"&&sid).value

the full script as below.

<script>
function Form1_Validator(theForm)
{
// require that the To Field be greater than or equal to the From Field

[Code]....

View 1 Replies View Related

Webkit - Add Another Word To The Range?

Jul 14, 2011

Suppose I've made my range so that it covers a word, using range.expand('word'). Typically to add the next word, I would write range.moveEnd('word', 1). But this seems not to work in Webkit. Perhaps it should be implemented differently?

View 4 Replies View Related

Mouse To Return Document.range

Jul 23, 2005

there are 2 divisions. there is a word-document loaded in first division.
when the user clicks somewhere in the document, i need some event to
return to me something that is a valid activedocument.range, so i can
select it and work with it.

View 1 Replies View Related

Validate Numeric Range 6-10 Digits

Jul 20, 2005

I'm currently using formchek.js to validate various form fields, however, I cannot figure out how to validate a field with a numeric range of 6-10 digits. I apologize in advance for asking such a question since I'm using formchek.js, but my strength is server-side programming not JavaScript.

View 5 Replies View Related

JQuery :: One Function For A Range Of Forms?

Sep 24, 2009

I have the following code which just submits my login form via AJAX. It works fine. But I am wondering if I can adjust this to work for pretty much every form on my website, rather then copy paste this code over and over and only changing the values to match the form respectively.

[Code]...

View 3 Replies View Related

Generate Random Number Within A Range?

Jun 30, 2009

I am trying to generate random number within a range. My code at the moment is

Code:

var uppermax = 100; var uppermin = 10; var upperdiff = uppermax - uppermin; var lowermax = 10; var lowermin = 0; var lowerdiff = lowermax - lowermin; var rand = Math.floor(upperdiff + 1) * Math.random() + uppermin; alert(rand);

I know math.floor is supposed to round down to the nearest integer, but the generator is still coming back with a float.

View 1 Replies View Related

Select Records By Date Range?

Apr 24, 2009

I'm selecting records (open PO) and assign a different column base on the due date to quntity that is due but I'm getting a syntax error when i run the query. see code below

SELECT
PRTNUM_10,
CURDUE_10,

[code]....

View 2 Replies View Related

Move Start And End Points Of A Range?

Jul 1, 2011

I am trying to wrap a text selection with BBCode. I have it working, but there is one final part I need help with.[code]...

So, the last thing I need to do (the whole point of this post)... how do I MOVE the range start and end points so that only the selection is selected and NOT the whole thing?

View 5 Replies View Related

Jquery :: Datepicker Range Validation?

Nov 18, 2010

i'm using a jquery datepicker like this:

<script type="text/javascript">
$(function() {
$('#inlineDatepicker').datepick({

[code]....

View 1 Replies View Related

JQuery :: Create A Site That Allows For Images To Go Full Browser And Then Have The Ability To Have The Other Images Slide In Based On A Click?

Mar 9, 2010

I prefer jQuery over flash and not sure how to tackle this, so please advise as best you can. Trying to create a site that allows for images to go full browser and then have the ability to have the other images slide in based on a click.

I also want to float a menu that will allow it to pull in other media (video, that would slide in the same way). The best example I can share is this: http://j.mp/5U79i1 What he is using is flash based (slideshowpro director and slideshow pro for flash). Not interested in flash for this personal project.

View 2 Replies View Related







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