ASP development of the abstract plugin submitting form

Source: Internet
Author: User
Submit a Form | Abstract example: specific features see "I Love Blog (http://www.woiblog.com)" in the relevant use of the introduction!

1, to achieve the function is in the browser plus a right key shortcut to submit the selected page or picture Content! Example application in the blog program, is that you have logged in the case, browsing the web to see the better news or pictures! You can select the content--"add my Net", then will pop up an IE window, automatically add the page title to the title of the form of the corresponding content, and select the content to add the relevant items, as well as the reference URL!

2, now let's take a look at how this function is implemented!

First we write with a text editor:
Windows Registry Editor Version 5.00

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

[HKEY_CURRENT_USER\Software\Microsoft\Internet explorer\menuext\ Add this page to my net pick]
@= "Http://www.woiblog.com/UserManage/addblog.asp"

。 Save As. REG file, write registry key add right Menu

http://www.woiblog.com/UserManage/addblog.asp for processing pages
The source files are as follows:

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title></title>
<body lang= "ZH-CN" >
<form id=form1 action= "user_post_blog2.asp" method= "Post" >
<P>
<input type= "hidden" name= "title" Id=title1>
<input type= "hidden" name= "url" id=url1>
<input type= "hidden" name= "JS" id=js1>
<textarea id=content1 style= "Display:none" name= "content" ></TEXTAREA> </P>
</form>
</body>

<script language= "Javascript" >

var owin = external.menuarguments;
var odoc = owin.document;
var titlestr;
var start, end;
var getzy;
Start = end =-1;
Titlestr = OWin.document.selection.createRange (). text;
for (var i = 0; i < titlestr.length; i++)
{
if (start = = 1)
if (Titlestr.charat (i) = = ' \ n ' | | titlestr.charat (i) = = ' \ r ')
Continue
Else
start = i;
else if (Titlestr.charat (i) = = ' \ n ' | | titlestr.charat (i) = = ' \ r ')
{
end = i;
Break
}

}

If (Start!=-1 && End!=-1 && start < end)
Form1.title1.value = Odoc.title;
Else
Form1.title1.value = Odoc.title;


for (var i = 0; i < oDoc.images.length; i++)
{
Odoc.images (i). src = odoc.images (i). Src;
}

for (var i = 0; i < oDoc.links.length; i++)
{
Odoc.links (i). href = Odoc.links (i). href;
}

Form1.url1.value = Odoc.url;
Getzy = ODoc.selection.createRange (). text;
Form1.js1.value = getzy.substr (0, 250) + "...";
Form1.content1.innerText = OWin.document.selection.createRange (). HTMLText;

Form1.submit ();
</script>
Believe a lot of people understand, above is a common form, the following is a script, the key is still below
Odoc.title Page Title
Odoc.url Web Address
Getzy = ODoc.selection.createRange (). text; ' Get the selected content in a textual way
Form1.js1.value = getzy.substr (0, 250) + "..."; ' Get the first 250 characters, the ... End, as an introduction
Form1.content1.innerText = OWin.document.selection.createRange (). HTMLText; HTML method to get the selected content
Form1.submit (); Automatically submit form to action in form: user_post_blog2.asp
Here has done the acquisition of information! Then is the ordinary ASP form processing!
Like the value of the title, use Value=<%=request ("title")%>
The rest of the same son move is!

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.