Eric @ EricBess WebHome

一味思考而不行动,将在不知不觉中变得无意义

Chinese (Simplified) flagItalian flagKorean flagPortuguese flagEnglish flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag
By N2H

CSS中关于定位

在CSS中关于定位的内容是:position:relative | absolute | static | fixed

static 没有特别的设定,遵循基本的定位规定,不能通过z-index进行层次分级。
relative 不脱离文档流,参考自身静态位置通过 top,bottom,left,right 定位,并且可以通过z-index进行层次分级。
absolute 脱离文档流,通过 top,bottom,left,right 定位。选取其最近的父级定位元素,当父级 position 为 static 时,absolute元素将以body坐标原点进行定位,可以通过z-index进行层次分级。
fixed 固定定位,这里他所固定的对像是可视窗口而并非是body或是父级元素。可通过z-index进行层次分级。

CSS中定位的层叠分级:z-index: auto | namber

relative | absolute | static | fixed这四种定位的方式不一样,我们要找到元素的位置的方法也会随之不一样。

Dom元素提供了三种方式来定位元素:offset,scroll,Client

Click to continue reading

09月 8th, 2008 Posted by eric | 网站技术 | no comments

Jquery效果:实现“即点即改”

目标

一个用AJAX(或AHAH)技术设计的页面,访问者无需离开就可以在看到的(x)HTML 页面上编辑内容。

方案

点击需要编辑的文本,变幻出一个带有保存和取消按钮的textarea。修改的部分将通过AHAH传送至服务器端的一个PHP脚本文件,用来更新数据库(MySQL或普通文件)。

演示

AJAX式即点即改演示
在这第一个演示中,我使用了一个id为“editinplace”的div元素。当鼠标划过这里时,背景颜色将变成浅黄色。点击文本将启动一些DOM操作,div元素被一个textarea元素取代–内中包含原先的文本。
点击保存按钮将向服务器端的PHP脚本文件发送新的HTML内容,并重新输出收到的新文本内容(通过 $_POST)。
在真实应用环境下,你还应当添加一个安全性检测,然后才能更新数据库并返回更新后的页面内容,同事告知jQuery执行成功的信息。

1 2 3

07月 20th, 2008 Posted by eric | Coding, 网站技术 | no comments

Jquery效果:样式表切换

DEMO

熟悉的开篇
$(document).ready(function(){
$('.styleswitch').click(function()

告诉jQuery“以最快的速度查找所有包含对象名‘styleswitch’的元素,并在他们被鼠标点击时执行一个函数”。
看起来不错。当鼠标点击预先指定的元素时,switchStylestyle函数将被调用。从现在开始是重点。

$('link[@rel*=style]').each(function(i) {

这句话什么意思?
找到了jQuery的作者John Resig,向他咨询。他直接给了我一个jQuery网站的页面地址,里面讲解了若干jQuery提供的高级特性(xpath),可以用来查找并操作页面中的若干元素。如果你看过这些东西你就能明白上面那句神秘的代码的含义是告诉jQuery“查找所有带rel属性并且属性值字符串中包含‘style’的link链接元素”。

Click to continue reading

07月 20th, 2008 Posted by eric | Coding, 网站技术 | one comment

Jquery效果:滑动面板

[html code='y']

Slide Panel

[/html]

07月 4th, 2008 Posted by eric | 网站技术 | no comments

PHP Paypal IPN Class

NEW VERSION

I rewrite the class, release the Version:1.3.1
v1.3.1 [06.25.2008] - more strict ipn validation,ssl fsockopen(),sandbox option.

Donate for this class development, Thanks!

This free PHP script provides a simple method to interface with paypal and the paypal Instant Payment Notification (IPN) system. It is not a complete system but a single PHP class allowing the PHP developer more control. Included in the zip file is a demonstration PHP script called paypal.php which shows the basic usage of the class.


This class handles the submission of an order to paypal as well as the processing an Instant Payment Notification (IPN). Including the demonstration file, the entire "paypal system" consists of just 2 PHP scripts. Once is the class and one implements the class.

Original Author: Micah Carrick
Website: http://www.micahcarrick.com

UPDATE DESCRIPTION

More Strict IPN Validation: add ipn_status and receiver mail validation.

  • $p->ipn_status //get the ipn validation status detial.

SSL fsockopen():change the fsockopen http(80) to ssl(443) //paypal ipn (80) support unstable.

Sandbox Option:Create a "sandbox" account for a buyer and a seller. This is just a test account(s) that allow you to test your site from both the seller and buyer perspective. The instructions for this is available at https://developer.paypal.com/ as well as a great forum where you can ask all your paypal integration questions. Make sure you follow all the directions in setting up a sandbox test environment, including the addition of fake bank accounts and credit cards.

  • $p = new paypal_class (true); //open sandbox
  • $p = new paypal_class(false); //live use

Click to continue reading

06月 27th, 2008 Posted by eric | Coding, 网站技术 | no comments

国际化Blog-Global Translator(翻译插件)

如果你想自己的Blog更为国际化不妨试试:Wordpress Global Translator Plugin,一个提供Blog翻译功能的插件,可结合 Google、Promt及Altavista Babel Fish等提供的翻译服务来为你的Blog文章进行翻译。

其实,该插件的功能远不止翻译那么简单,它还有助于SEO搜索引擎优化,它可以为每篇文章生成篇译文,并让搜索引擎收录,有助于增长流量,事实上我部署Global Translator一周后国际访问就大增。另外它还提供缓存功能(占用空间)及通过CSS来自定义翻译按钮的样式。

安装方法:

1、下载插件,上传到Wordpress插件目录,后台激活。进入选项->Global Translator菜单,选择翻译服务(我这边只有选Google Translation Services才能正常运行,不过你也可以试试其它),选择你的Blog语言,打开缓存选项,保存即可。

2、在模版(我在head.php)中插入如下代码。

1
2
3
4
5
< ?php>
if(function_exists("gltr_build_flags_bar")) {
gltr_build_flags_bar();
}
?>

Click to continue reading

05月 26th, 2008 Posted by eric | WordPress | no comments

PayPal PHP接口

PayPal 快速、安全而又方便,是跨国交易的首选在线付款方式。现在PayPal可以和国内大部分信用卡关联,可以实现国人的跨国交易收支。
申请PayPal注册网址:https://www.paypal.com/

paypal接口与其它接口有些不同,稍微复杂一点。 其实银行接口也算是一个站点的插件。

所谓paypal ipn(Instant Payment Notification),就是Paypal开发的一种能主动通知第三方卖家系统交易状态的一种机制。IPN的原理很简单,就是当产生了一个交易之后,交易状态发生变化时,如用户已经付款、或者退款、撤销时,Paypal利用常用的HTTP POST方式,将交易的一些变量提交给网站的某个页面(称之为IPN Handler),当这个页面接受到请求时候,将这些数据原封不动加上一个指示验证的cmd=_notify-validate,POST回Paypal的接口地址,如果数据正确,那么Paypal返回字符串VERIFIED,否则为INVALID,如果结果为VERIFIED,那么你的程序就可以使用这些数据进行操作。

开设Sandbox帐号

但代码的调试是一件很痛苦的事情,因为作为第三方开发人员,不可能开两个帐号,每次测试还要之间交易一些钱,所以Paypal专门开发了Sandbox给开发人员进行开发,首先到https://developer.paypal.com/ 注册一个开发帐号,好了之后再进入Sandbox建立测试用的Paypal虚拟帐号(至少应该建立一个Business的和一个Personal的),这种账号注册方法和Paypal的流程一样,信息可以是假的,包括银行帐号、信用卡(其实Paypal Sandbox会自动生成一些随机的号码)。接下来需要激活Paypal Sandbox的虚拟帐号,注意,这里不管你在Paypal Sanbox注册时填什么邮件地址,有任何发送到虚拟帐号所填邮箱的邮件都存会在开发帐号的管理界面中的Email页(导航栏上有)中。登录Sandbox的虚拟Paypal环境,还需要验证虚拟帐号的银行,这里可以随便填,然后通过Add Funds来给账户充值(想填多少填多少 920-203 920-533 )。然后,还需要激活IPN的选项,在Business的那个账户的Profile设置页面中,点击,然后点击Edit按钮,打开IPN,这里如果你使用的是固定的IPN Handle,可以直接将地址填入。

接下来,我们测试的时候,应该将Paypal接口的地址设置为https://www.sandbox.paypal.com/cgi-bin/webscr

1 2 3 4

03月 11th, 2008 Posted by eric | Coding, 网站技术 | no comments

WP-CODEBOX Plugin (代码高亮插件)

Author:Eric.Wang
Plugin URL:http://wordpress.org/extend/plugins/wp-codebox/
Tags: syntax highlighting, syntax, highlight, code, formatting
Requires at least: 2.0
Tested up to: 2.5.1
Stable tag: 1.3.1
Download

Donate for this plugin development, Thanks!

== Description ==

WP-CODEBOX代码高亮插件,支持多种语言、代码下载、复制到剪贴板、代码框收放及后台默认属性设置。本插件还在持续开发中,欢迎使用及报告bugs.
Wp-CodeBox provides clean syntax highlighting and advanced feature for embedding source code within pages or posts. It support a wide range of popular languages highlighting with line numbers, code download, Copy to clipboard, collapse codebox, automatic keywords link to API manual and maintains formatting while copying snippets of code from the browser.

It's provide simple background configuration for highlighter style/formatting customization.
Since the plugin is developing, in the future it will support more options.(CSS option,Keyword display style,Auto Caps/Nocaps,Case Sensitivity etc. )

Click to continue reading

03月 3rd, 2008 Posted by eric | WordPress | 116 comments

Page 2 of 7«1234567»