Using JavaScript and registry scripts to right-click a Web page select text _javascript tips

Source: Internet
Author: User
Two days ago found a good site on the Internet, is used to do the data collection (http://wolf.360doc.com).
This site provides such a function, you can directly put your selected text collection, at that time feel very magical. Later, it was discovered that using JavaScript and registry scripts would enable such a function.
Right-click to bookmark the page code below (my Favorites page is named rightclick.jsp):
Copy Code code as follows:

<script language= "JavaScript" >
if (external.menuarguments)
{
var selText = "";
var strtitle = Escape (External.menuArguments.document.title);
var strURL = Escape (external.menuArguments.location.href);

var doc = external.menuArguments.document;

if ((Doc.selection.type = "None") | | (Doc.selection.type = = "None"))
{
Alert ("Please select the text and pictures you want to save on the page.") ");
}
Else
{
SelText = Doc.selection.createRange (). text;
if (SelText = "")
{
Alert ("Please select the text and pictures you want to save on the page.") ");
}
Else
{
External.menuArguments.document.execCommand ("Copy");

var objchild; Window
var rework = new RegExp (' object ', ' GI '); Regular expression
Objchild = window.open ("savemenu.jsp?title=" +strtitle+ "&url=" +strurl, "Objchild", "Toolbar=no,menubar=no, Resizable=yes,location=no,status=yes,z-look=yes,alwaysraised=yes,scrollbars=no ");
if (!rework.test String (objchild))
Alert ("Article favorites page is blocked!") \ r \ n Please set the blocking pop-up software you installed so that the current page is not intercepted! ");
}
}
}
</script>

the text display page code is as follows (my Favorites page is named savemenu.jsp):
Copy Code code as follows:

<HTML>
<HEAD>
<title> Network Collection </title>
<script language= "JavaScript" >

<!--hide Me
function Preloader ()
{
var Editor1 = document.getElementById (' TextBox ');
TextRange = Editor1.createtextrange ();
Textrange.execcommand ("Paste");

}


-->
</script>

</HEAD>
<body vlink= "#261cdc" link= "#261cdc" leftmargin= "0" topmargin= "5" onload= "settimeout (' Preloader (); ', 1000);" >
<p title= "Network Favorites text Box" > Network Favorites text Box </p>
<textarea name= "textbox" id= "TextBox" style= "height:300px;width:100%;" ></textarea>
</body>
</HTML>

The registry script is as follows:
Copy Code code as follows:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\menuext]

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\menuext\localhost Test]
@= "Http://10.1.1.19:8080/test/rightClick.jsp"


If you are interested, you can try it yourself!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.