Create Your Signature For Your Blog,
Today,a MSN space tip which enabled us to create our signature for our blog was introduced to me.
The principle of the signature creation is very easy.Remeber the Edit-It button and its js code in that button?When we replace the js code in ours in that button,we can made our blog editor work in our way.
So,when you use the tool creating signature for your blog written by Eric Swanson,you will see Eric Swanson use the js assignment in the button as below
if(navigator.userAgent.indexOf('MSIE')>0 && document.all.rtebox!=null)
{
void(document.EditBox.document.EditBox.document.all[6].innerHTML+='<P><FONT face='Comic Sans MS' color=#ffff00 size=4><EM><SUB><STRONG>Sanall Cobain</STRONG></SUB></EM></FONT></P>';);
}
When i use the button contained the js above, an error occured,no more information can be got from the error prompting dialog.
I guessed that the statement didn't work well when document.all[6] object was invited by IE.I didn't know what object document.all[6] standed for.So i explored the RTE.js file again to try to get some guidelines.
Fortunately,a function named as appendHTML() was found.I rewrite the js as in my way below,
if(navigator.userAgent.indexOf('MSIE')>0 && document.all.rtebox!=null)
{
EditBox.appendHTML('<P><FONT face='Comic Sans MS' color=#ffff00 size=4><EM><SUB><STRONG>Sanall Cobain</STRONG></SUB></EM></FONT></P>');
}
It's much more clear and simple than Eric Swanson's,and works very well.
And finally,i wrote my own version of the signature-creation button using the js code below,
if(navigator.userAgent.indexOf('MSIE')>0%20&&%20document.all.rtebox!=null)
{
EditBox.appendHTML("<P align='right'><FONT%20face='Comic Sans MS' color='=#00ff00'><EM><SUB>Sanall%20Cobain posted on "+(new Date()).toString()+"</SUB></EM></FONT></P>");
}
Reference: Scotte's Edit-It Button
Eric Swason's Signature Creation Tool
RTE.js file of MSN Space
白色部分为Rainwalk添加(谁看的见……)。英文没人看吗?Sanall,下回同时弄个中文说明。
不过,Sanall,似乎没必要说这么多吧,实际就是添加一段预先设好的代码: