word

页面

mouse snow

2014年1月9日星期四

How to show the HTML code in webpage?

The HTML code will automatic become the command, so that cannot like the words or text show on the webpage. Here, I will show you how to show the HTML code in webpage :)

Method 1: use textarea ~ codecontiner

Example:

use this code:
<textarea class="codecontainer" rows="8" cols="45" wrap="virtual">


Method 2: separate the code

Example:
If you want show :

then you can write like this :

so that the <script type="text/javascript"> can be show :)

鼠标效果(文字绕着鼠标转)(message circle your cursor)

在这里,给大家介绍一个鼠标效果~~~文字绕着鼠标转(message circle your cursor)

Description: Have a textual message circle your mouse cursor and follow it around using this DHTML script.
简介:文字会跟着你的鼠标,而且会绕着转,这是使用DHTML。


English:Design -> Add A Gadget -> HTML/JavaScript
华语: 布局 -> 添加小工具 -> HTML/JavaScript

复制(ctrl + c)以下的代码放进去
<style type="text/css">
/* Circle Text Styles */
#outerCircleText {
/* Optional - DO NOT SET FONT-SIZE HERE, SET IT IN THE SCRIPT */
font-style: italic;
font-weight: bold;
font-family: 'comic sans ms', verdana, arial;
color: #000;
/* End Optional */

/* Start Required - Do Not Edit */
position: absolute;top: 0;left: 0;z-index: 3000;cursor: default;}
#outerCircleText div {position: relative;}
#outerCircleText div div {position: absolute;top: 0;left: 0;text-align: center;}
/* End Required */
/* End Circle Text Styles */
</style>
<script type="text/javascript">

;(function(){

// Your message here (QUOTED STRING)
var msg = "你的文本/Your Text Here";

/* THE REST OF THE EDITABLE VALUES BELOW ARE ALL UNQUOTED NUMBERS */

// Set font's style size for calculating dimensions
// Set to number of desired pixels font size (decimal and negative numbers not allowed)
var size = 24;

// Set both to 1 for plain circle, set one of them to 2 for oval
// Other numbers & decimals can have interesting effects, keep these low (0 to 3)
var circleY = 0.75; var circleX = 2;

// The larger this divisor, the smaller the spaces between letters
// (decimals allowed, not negative numbers)
var letter_spacing = 5;

// The larger this multiplier, the bigger the circle/oval
// (decimals allowed, not negative numbers, some rounding is applied)
var diameter = 10;

// Rotation speed, set it negative if you want it to spin clockwise (decimals allowed)
var rotation = 0.4;

// This is not the rotation speed, its the reaction speed, keep low!
// Set this to 1 or a decimal less than one (decimals allowed, not negative numbers)
var speed = 0.3;

////////////////////// Stop Editing //////////////////////

if (!window.addEventListener && !window.attachEvent || !document.createElement) return;

msg = msg.split('');
var n = msg.length - 1, a = Math.round(size * diameter * 0.208333), currStep = 20,
ymouse = a * circleY + 20, xmouse = a * circleX + 20, y = [], x = [], Y = [], X = [],
o = document.createElement('div'), oi = document.createElement('div'),
b = document.compatMode && document.compatMode != "BackCompat"? document.documentElement : document.body,

mouse = function(e){
e = e || window.event;
ymouse = !isNaN(e.pageY)? e.pageY : e.clientY; // y-position
xmouse = !isNaN(e.pageX)? e.pageX : e.clientX; // x-position
},

makecircle = function(){ // rotation/positioning
if(init.nopy){
o.style.top = (b || document.body).scrollTop + 'px';
o.style.left = (b || document.body).scrollLeft + 'px';
};
currStep -= rotation;
for (var d, i = n; i > -1; --i){ // makes the circle
d = document.getElementById('iemsg' + i).style;
d.top = Math.round(y[i] + a * Math.sin((currStep + i) / letter_spacing) * circleY - 15) + 'px';
d.left = Math.round(x[i] + a * Math.cos((currStep + i) / letter_spacing) * circleX) + 'px';
};
},

drag = function(){ // makes the resistance
y[0] = Y[0] += (ymouse - Y[0]) * speed;
x[0] = X[0] += (xmouse - 20 - X[0]) * speed;
for (var i = n; i > 0; --i){
y[i] = Y[i] += (y[i-1] - Y[i]) * speed;
x[i] = X[i] += (x[i-1] - X[i]) * speed;
};
makecircle();
},

init = function(){ // appends message divs, & sets initial values for positioning arrays
if(!isNaN(window.pageYOffset)){
ymouse += window.pageYOffset;
xmouse += window.pageXOffset;
} else init.nopy = true;
for (var d, i = n; i > -1; --i){
d = document.createElement('div'); d.id = 'iemsg' + i;
d.style.height = d.style.width = a + 'px';
d.appendChild(document.createTextNode(msg[i]));
oi.appendChild(d); y[i] = x[i] = Y[i] = X[i] = 0;
};
o.appendChild(oi); document.body.appendChild(o);
setInterval(drag, 25);
},

ascroll = function(){
ymouse += window.pageYOffset;
xmouse += window.pageXOffset;
window.removeEventListener('scroll', ascroll, false);
};

o.id = 'outerCircleText'; o.style.fontSize = size + 'px';

if (window.addEventListener){
window.addEventListener('load', init, false);
document.addEventListener('mouseover', mouse, false);
document.addEventListener('mousemove', mouse, false);
if (/Apple/.test(navigator.vendor))
window.addEventListener('scroll', ascroll, false);
}
else if (window.attachEvent){
window.attachEvent('onload', init);
document.attachEvent('onmousemove', mouse);
};

})();

</script>
Red color = can change it,
红色 = 可改的,

你可以只改这两样东西:
var msg = "你的文本/Your Text Here"; ,把你的文本/Your Text Here改成你要的字。
var size = 24; ,把24改成你要的字体大小。
color: #000; ,把000改成你要的颜色(我的博客的右边有颜色代码)。

Another cursor effect:
  1. Custome cursor script (Crosshair mouse cursor) 
  2. Image Trail Script 
  3. Comet Trail 
  4. Kissing trail

2014年1月8日星期三

How to short the long URL?

Here, I want to introduce this 3 URL shortener provider,
  1. Google URL shortener
  2. TinyURL
  3. Bitly

Each of them also can help you to short the URL you want.

Before the URL is:
https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1365487341&rver=6.1.6206.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&lc=1033&id=64855&mkt=en-us&cbcxt=mai&snsc=1

After use the Google URL shortener:
http://goo.gl/Gyu6ib

After use the TinyURL:
http://tinyurl.com/l9oyfdy

After use the Bitly:
bit.ly/1ijeDGP

All of them are very easy to use, so no tutorial :) 
Which one you like?
back to top