JS Extended z-blog Picture Verification code Click Automatic Refresh and Comment content automatic save _ Application Tips

Source: Internet
Author: User
At the end of Script/common.js to add the following words can realize the automatic Image Verification code refresh and comment content automatically save (forie)
Because of the Z-blog JS expansion mechanism is not good enough, in the case of the extension of things can only use Window.onload (IE).
Since the use of window.onload, then simply use Window.clipboarddata.
Are we looking forward to these two functions for a long time? Without Ajax, these two features are too important, too important, too important.
The actual function is not perfect because of congenital defects, the next version, the idea is to add a sentence below each page to read Loadextrascript ().
And then through this to automatically refresh the verification code, do not have the hand point (now use window.onload for automatic very slow, because to wait for the picture loading) in fact, should be in the IMG when the onload to trigger an automatic refresh verification code function objimage.src= objimage.src+ "&random=" +math.random () or verification code simply do not use any IMG tags, simply use the pure JS to ensure that after the back of the verification code also automatically refreshed, and now many large web sites is such a way!
Even the things that are now under each page are integrated into it.
By the way, the first two days suddenly thought of why the speed of reconstruction so slow, why the automatic installation script so fast ... Is it a little enlightening?? Can you do it as fast as an automated setup script? Oh, did you think of that? :)
Copy Code code as follows:

//*********************************************************
Purpose: Extend function entry
Input: None
Back: None
//*********************************************************
function Loadextrascript ()
{
try{
Validcoderefresh ();
Savecomment ();
}catch (e) {}
}
//*********************************************************
Objective: Automatically refresh the verification code after the mouse clicks the picture
Input: None
Back: None
//*********************************************************
function Validcoderefresh () {
var imgs= document.getelementsbytagname ("img");
var hint = document.createelement ("span");
Hint.innerhtml= "If you just press [back] please click on the picture Refresh verification Code";
for (var i = 0; i < imgs.length; i++) {
if (Imgs[i].src.indexof ("C_validcode.asp?name=commentvalid")!==-1) {
var objimage=imgs[i];
ObjImage.parentNode.appendChild (hint);
Objimage.attachevent (' onmouseover ', function () {objimage.style.cursor= ' hand ';});
Objimage.attachevent (' onclick ', function () {objimage.src=objimage.src+ "&random=" +math.random ();});
}
}
}
//*********************************************************
Purpose: Automatically save on clipboard after user submits comments
Input: None
Back: None
//*********************************************************
function Savecomment ()
{
var btnsumbit=document.getelementsbyname ("Btnsumbit");
var Txaarticle=document.getelementbyid ("Txaarticle");
var hint = document.createelement ("span");
Hint.innerhtml= "<p> your comments will be automatically saved on the Clipboard </p>."
TxaArticle.parentNode.appendChild (hint);
Btnsumbit[0].attachevent (' onclick ', function () {Window.clipboardData.setData ("Text", Txaarticle.innertext);});
}
//*********************************************************
Purpose: Extend function-load
Input: None
Back: None
//*********************************************************
Window.onload=loadextrascript;

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.