How To Select Content Of A Div
Posted April 5th 2012, 4:48am
Hi, i was looking today at mi web and i thought that it would be cool to have a select code button.

Look: http://bittnet.es.tl/Caja-Compartir-Web.htm

You can see that i have the blockquote with the codes, but it would be cool to set up a select all button, i was looking at the foruomotion one to see if i could create my own code based on that one, but i failed so i know come to ask for help.

PD. Sorry if the post doesn't go here, im lost with the new forum...
φ
Posts: 81
Joined: July 15th 2011, 11:00pm
Likes Received: 1
How To Select Content Of A Div
Posted April 5th 2012, 11:53am
As long as you can add a DIV tag immediately before the BLOCKQUOTE tag, and put the "Select Code" button in that DIV tag, it would be easy to modify the "Select code" script to select the contents of the BLOCKQUOTE tags.

The script will first need to decode the contents of the BLOCKQUOTE tag. It has been encoded (using the PHP htmlspecialchars() function) to allow the HTML tags in the quote block to be displayed, as opposed to being rendered by the browser.

Assuming you have created the DIV tag as I described, find the lines at the top of the "Select Code" script that that look something like this:

function selectCode(a) {
// Get ID of code block
var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];

Replace them with:

function selectCode(a) {
// Get ID of code block
var e = document.createElement('DIV');
var x = a.parentNode.nextSibling.innerHTML;
e.innerHTML = x.replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
How To Select Content Of A Div
Posted April 5th 2012, 4:04pm
I dont understand
I can modify the pages as i want and i can add/edit all te content of the page
but i dont undesrtand the script
φ
Posts: 81
Joined: July 15th 2011, 11:00pm
Likes Received: 1

Who is online

Users browsing this forum: No registered users and 2 guests