It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Grabbing the table when selecting the text inside its cells

Grabbing the table when selecting the text inside its cells

Postby coe15 on Fri May 16, 2008 6:19 am

Is there any one who can provide me a source code for grabbing the table when selecting the text inside its cells, I have created a bookmarklet for grabbing a selected text but unfortunately its function is limited. Is there any one who can help me? Thanks...
this is the link in the bookmarklet w/ limited function as i have mentioned.
http://coe15.007sites.com/File3.html :( Javascript
coe15
 
Posts: 2
Joined: Fri May 16, 2008 6:10 am

Postby coe15 on Fri May 16, 2008 6:28 am

//this the code for selecting the highlighted text... Please help..

/ Grab.js
(function(){
//javascript:

var d,w,s,x,h="";

if (window.getSelection) {
s = window.getSelection();
if (s.rangeCount && !s.getRangeAt(0).collapsed){
x = document.createElement("div");
x.appendChild(s.getRangeAt(0).cloneContents());
h=x.innerHTML;
}
} else {
h = document.selection.createRange().htmlText;
}
if(h){
//d=window.open().document;
//d.close();
//alert(h);

// create form
myform = document.createElement("Form");
myform.action ="http://localhost/work/try.php";
myform.method = "post";

// create input
myinput = document.createElement('input');
myinput.type='hidden';
myinput.name='h';
myinput.value = h;
myform.appendChild( myinput);

myinput2 = document.createElement('input');
myinput2.type='hidden';
myinput2.name='src';
myinput2.value = location.href;
myform.appendChild( myinput2);

mysubmit = document.createElement('input');
mysubmit.type='submit';
myform.appendChild( mysubmit);
document.body.appendChild(myform);


//self submit
myform.submit();

}

})();
coe15
 
Posts: 2
Joined: Fri May 16, 2008 6:10 am


Who is online

Users browsing this forum: No registered users and 5 guests