AJAX Forums

Multiple Div Selection

This is a discussion on Multiple Div Selection within the AJAX Ideas forums, part of the General category; Hi, I need to select multiple divs and has to apply text formating properties like (font size, color, bold, italic etc.) so that text formating is applied on all selected ...

Go Back   AJAX Forums > General > AJAX Ideas

AJAX Made Easy

Old 04-25-2009, 02:03 AM   #1 (permalink)
Junior Member
 
Join Date: Apr 2009
Posts: 2
Rep Power: 0
testemailtusa is on a distinguished road
Multiple Div Selection

Hi,

I need to select multiple divs and has to apply text formating properties like (font size, color, bold, italic etc.) so that text formating is applied on all selected
divs.

Also I want to know the way to selected multiple divs at a time using Ctrl key.

Any script will be of great help

Thanks in advance
testemailtusa is offline   Reply With Quote
Sponsored Links
Old 02-22-2010, 03:04 AM   #2 (permalink)
Junior Member
 
Join Date: Feb 2010
Posts: 5
Rep Power: 0
w.cain is on a distinguished road
if (Drupal.jsEnabled) {
$(document).ready(function() {
var selected = new Array();

$('select').mouseover(function() {
if (this.multiple == true) {
for (var i=0,a=0;i<this.options.length;i++) {
if (this.options[i].selected == true) {
selected[a] = this.options[i].value;
a++;
}
}
}
});

// safe them when you click the mouse
$('select').click(function() {
// make sure it's a multiple select
if (this.multiple == true) {
for(var i=0;i<selected.length;i++) {
for(var a=0;a<this.options.length;a++){
if (selected[i] == this.options[a].value && this.options[a].selected == true) {
this.options[a].selected = false;
selected.splice(i,1);
} else if (selected[i] == this.options[a].value) {
this.options[a].selected = true;
}
}
}
}

// load all selected options in array when the mouse pointer hovers the select box
if (this.multiple == true) {
for (var i=0,a=0;i<this.options.length;i++) {
if (this.options[i].selected == true) {
selected[a] = this.options[i].value;
a++;
}
}
}

});
});
}

If you want to add this to your drupal installation, copy paste the code into /misc/multipleselect.js, then add

<script type="text/javascript" src="/misc/multipleselect.js"></script>

into your page.tpl.php. If you want to use it in a non-drupal installation, just leave out the the first (if (Drupal.jsEnabled) {) and last (}) line of this snippet.
w.cain is offline   Reply With Quote
Reply

Bookmarks

Tags
multiple divs, multiple layers, text formating on divs


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Multiple XML responses in IE NBFruit AJAX Help 1 08-08-2007 06:47 PM
Real-World AJAX Book Preview: Row Selection in the SimpleTable microbee AJAX Help 0 04-24-2007 07:02 PM


All times are GMT -4. The time now is 06:30 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0
Copyright ©2006 - 2009, AJAXwith.com