JS 敲回车按钮 登陆 支持火狐 和 iE浏览器.

 

 

<script src="jquery-1.6.2.min.js" type="text/javascript"></script> 
<script> 
$(function(){ 

$("#verifyCode").keypress(function(event){ 
    if(event.keyCode==13||event.which==13){ 
loginCheck();   

}else{ 
return false; 

}); 
}) 
</script>

 ============================================

登陆的 敲回车按钮在使用event事件来监听支持火狐 和 iE浏览器.

/**

 * 判断浏览器;

 * @return

 */

function getOs() 

    var OsObject = ""; 

    if(navigator.userAgent.indexOf("MSIE")>0) { 

         return "MSIE"; 

    } 

    if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 

         return "Firefox"; 

    } 

    if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 

         return "Safari"; 

    }  

    if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 

         return "Camino"; 

    } 

    if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 

         return "Gecko"; 

    } 

//回车键登陆,支持火狐和IE浏览器;

function loginEnterCheck(){

      //获取当前浏览器;

      var browser = getOs();

    

      if(browser=="Firefox"){

          //判断IE还是火狐浏览器;

          $("html").die().live("keydown",function(event){     

                if(event.keyCode==13){    

                    //调用登陆方法;

                    loginCheck();     

                }     

          });   

      }

      

      //如果是IE获取其他浏览器,则调用此种方式;

      if(browser=="" || browser=="MSIE"){

          if(event.keyCode==13){

                loginCheck();

            }

      }

}

===========================================

 

Jquery插件–easyUI属性汇总(转)

找了个时间看了下EasyUI插件,对它的插件感觉是很舒服,特地把Easy UI的大部分功能属性做了一下汇总。

此属性列表请对照jQuery EasyUI 1.0.5,关于它的更多资讯请猛击这里

属性分为CSS片段和JS片段。

CSS类定义:
1、div easyui-window        生成一个window窗口样式。
      属性如下:
                   1)modal:是否生成模态窗口。true[是] false[否]
                   2)shadow:是否显示窗口阴影。true[显示] false[不显示]
            
2、div easyui-panel           生成一个面板。
       属性如下:
                 1)title:该标题文本显示在面板头部。
                 2)iconCls:在面板上通过一个CSS类显示16×16图标。
                 3)width:设置面板宽度。默认auto。
                 4)height:设置面板高度。默认auto。
                 5)left:设置面板左边距。
                 6)top:设置面板顶部位置。
                 7)cls:在面板中增加一个Class类。
                 8)headerCls:在面板头部中增加一个Class类。
                 9)bodyCls:在面板内容中增加一个Class类。
                10)style:在面板中增加一个指定样式。
                11)fit:当True时设置该面板尺寸适合于它的父容器。默认false。
                12)border:当定义时显示面板边界。默认true。
                13)doSize:如果设置为True,该面板将重绘大小,并重建布局。默认true。
                14)collapsible:当定义时显示可折叠面板的按钮。默认false。
                15)minimizable:当定义时显示最小化面板的按钮。默认false。
                16)maximizable:当定义时显示最大化面板的按钮。默认false。
                17)closable:当定义时显示关闭面板的按钮。默认false。
                18)tools:自定义工具栏,每个工具都包含两个属性:iconCls、handler。
                19)collapsed:当定义时该面板初始化时处于收缩状态。默认false。
                20)minimized:当定义时该面板初始化时处于最小化状态。默认false。
                21)maximized:当定义时该面板初始化时处于最大化状态。默认false。
                22)closed:当定义时该面板初始化时处于关闭状态。默认false。
                23)href:一个url,加载远程数据并显示在面板中。
                24)loadingMessage:当加载远程数据时,在面板中显示一个消息。默认Loading…
             事件如下:
                 1)onLoad:当远程数据加载完毕后激活。
                 2)onBeforeOpen:当面板打开前激活。
                 3)onOpen:当面板打开后激活。
                 4)onBeforeClose:当面板关闭前激活。
                 5)onClose:当面板关闭后激活。
                 6)onBeforeDestroy:当面板销毁前激活。
                 7)onDestroy:当面板销毁后激活。
                 8)onBeforeCollpase:当面板收缩前激活。
                 9)onCollapse:当面板收缩后激活。
                10)onBeforeExpand:当面板扩展前激活。
                11)onExpand:当面板扩展后激活。
                12)onResize:当面板重绘后激活。
                      width:新建的外部宽度
                      height:新建的外部高度
                13)onMove:当面板移动后激活。
                     left:左侧新位置。
                     top:顶部新位置。
                14)onMaximize:当窗口最大化

来自某群的99的分享

盛大创新院面试页面重构的js题目。。。

★列出display的值
可用值 值的说明
block 象块类型元素一样显示。
none 缺省值。向行内元素类型一样显示。
inline-block 象行内元素一样显示,但其内容象块类型元素一样显示。
list-item 象块类型元素一样显示,并添加样式列表标记。
table-header-group 显示在任何表格行和行组合之前,在头部标题之后。
table-footer-group 显示在任何表格行和行组合之后,在底部标题前。

★清除浮动与闭合浮动的不同点 (http://www.cnblogs.com/mofish/archive/2012/05/14/2499400.html)

★如何为元素绑定事件(就是addEvent)

function addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);//DOM2.0
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent(‘on’ + evType, fn);//IE5+
return r;
}
else {
elm['on' + evType] = fn;//DOM 0
}
}

★window.onbeforeunload 的用法
(http://www.cnblogs.com/snandy/archive/2012/05/03/2481019.html)

★说一下window.onerror的参数
(http://blog.csdn.net/zzxll5566/article/details/6187943)

★列出IE与FF的事件对象的不同点
(http://www.ok12.net/js/125.html)

★如何用CSS画三角形
(利用border属性)

★你平时是如何调试JS代码的
(firebug,IE开发人员工具,opera是当中最好的)

★如何判定一个脚本是否加载成功

var script = document.createElement(‘script’) ;
var head = document.getElementsByTagName(“head”)[0];
head.insertBefore(script, head.firstChild);//规避IE6下自闭合base标签BUG
script.onload = script.onreadystatechange = function(){//先绑定事件再指定src发出请求
if(/loaded|complete|undefined/.test(this.readyState) && !this.once ){
this.once = 1;
this.parentNode.removeChild(this);
}
}
script.src = ’http://files.cnblogs.com/rubylouvre/html5.js’

(IE onreadystatechange事件,判定节点的readyState值是否为loaded或complete, 其他浏览器则使用onload)

★如何判定iframe里面的资源都加载完毕
(http://www.cnblogs.com/lhgstudio/archive/2010/10/24/1859946.html)

★怎么判定一个节点是在DOM树中
(http://www.cnblogs.com/rubylouvre/archive/2009/10/14/1583523.html)

★指出JS拖动的原理
(将元素绝对定位,一点点地改变其top,left样式来实现移动的效果,top,left可以通过鼠标获取)

★说一下css transform2D与transform3D的区别(一个是2*3矩阵,一个是4*4矩阵,transform3D支持GPU硬件加速,更加流畅,建议用transform3D模拟transform2D)

★指出{}+[]与[]+{}的值,为什么 (第一个为0,因为{}放在语句在前面,JS引擎认为它只是一个块,不是空对象,相当于+[] ===> +”" ==> 0, 第二个是”[object Object]“,两者取toString(),然后相加)

★说一下浏览器资源加载的情况,IE与其他浏览器各版本的不同之外
(http://www.otakustay.com/browser-strategy-loading-external-resource/)

★说一下最近非常流行模块加载,大概是怎么实现的,有什么好处(http://www.cnblogs.com/muguaworld/archive/2011/11/27/2265356.html)

 

Stay Hungry, Stay Foolish--2005斯坦福大学05年毕业演讲

斯蒂夫•保罗•乔布斯(Steve Paul Jobs,1955年2月24日出生-)是蘋果電腦的現任首席執行長(首席执行官)兼創辦人之一。同時也是Pixar動畫公司的董事長及首席執行長。这是他2005在斯坦福大学做的毕业演讲。。。很鼓舞人。。。也许精彩就在平实之间。。。

Thank you.
I’m honored to be with you today for your commencement from one of the finest universities in the world. Truth be told, I never graduated from college, and this is the closest I’ve ever gotten to a college graduation. Today, I want to tell you three stories from my life. That’s it. No big deal. Just three stories.

The first story is about connecting the dots.

I dropped out of Reed College after the first six months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out?

It started before I was born. My biological mother was a young, unwed graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife — except that when I popped out they decided at the last minute that they really wanted a girl.

So my parents, who were on a waiting list, got a call in the middle of the night asking, “We’ve got an unexpected baby boy; do you want him?” They said, “Of course.” My biological mother found out later that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would go to college. This was the start in my life.

And 17 years later I did go to college. But I naively chose a college that was almost as expensive as Stanford, and all of my working-class parents’ savings were being spent on my college tuition. After six months, I couldn’t see the value in it. I had no idea what I wanted to do with my life and no idea how college was going to help me figure it out. And here I was spending all of the money my parents had saved their entire life.

So I decided to drop out and trust that it would all work out okay. It was pretty scary at the time, but looking back it was one of the best decisions I ever made. The minute I dropped out I could stop taking the required classes that didn’t interest me, and begin dropping in on the ones that looked far more interesting.

It wasn’t all romantic. I didn’t have a dorm room, so I slept on the floor in friends’ rooms. I returned coke bottles for the five cent deposits to buy food with, and I would walk the seven miles across town every Sunday night to get one good meal a week at the Hare Krishna temple. I loved it. And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on. Let me give you one example:

Reed College at that time offered perhaps the best calligraphy instruction in the country. Throughout the campus every poster, every label on every drawer, was beautifully hand calligraphed. Because I had dropped out and didn’t have to take the normal classes, I decided to take a calligraphy class to learn how to do this. I learned about serif and san serif typefaces, about varying the amount of space between different letter combinations, about what makes great typography great. It was beautiful, historical, artistically subtle in a way that science can’t capture, and I found it fascinating.

None of this had even a hope of any practical application in my life. But ten years later, when we were designing the first Macintosh computer, it all came back to me. And we designed it all into the Mac. It was the first computer with beautiful typography. If I had never dropped in on that single course in college, the “Mac” would have never had multiple typefaces or proportionally spaced fonts. And since Windows just copied the Mac, it’s likely that no personal computer would have them. If I had never dropped out, I would have never dropped in on that calligraphy class, and personal computers might not have the wonderful typography that they do. Of course it was impossible to connect the dots looking forward when I was in college. But it was very, very clear looking backwards 10 years later.
Again, you can’t connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something — your gut, destiny, life, karma, whatever — because believing that the dots will connect down the road will give you the confidence to follow your heart, even when it leads you off the well-worn path, and that will make all the difference.

My second story is about love and loss.

I was lucky — I found what I loved to do early in life. Woz1 and I started Apple in my parents’ garage when I was 20. We worked hard, and in 10 years Apple had grown from just the two of us in a garage into a two billion dollar company with over 4000 employees. We’d just released our finest creation — the Macintosh — a year earlier, and I had just turned 30.

And then I got fired. How can you get fired from a company you started? Well, as Apple grew we hired someone who I thought was very talented to run the company with me, and for the first year or so things went well. But then our visions of the future began to diverge and eventually we had a falling out. When we did, our Board of Directors sided with him. And so at 30, I was out. And very publicly out. What had been the focus of my entire adult life was gone, and it was devastating.

I really didn’t know what to do for a few months. I felt that I had let the previous generation of entrepreneurs down — that I had dropped the baton as it was being passed to me. I met with David Packard and Bob Noyce and tried to apologize for screwing up so badly. I was a very public failure, and I even thought about running away from the valley. But something slowly began to dawn on me: I still loved what I did. The turn of events at Apple had not changed that one bit. I had been rejected, but I was still in love. And so I decided to start over.

I didn’t see it then, but it turned out that getting fired from Apple was the best thing that could have ever happened to me. The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life.

During the next five years, I started a company named NeXT, another company named Pixar, and fell in love with an amazing woman who would become my wife. Pixar went on to create the world’s first computer-animated feature film, Toy Story, and is now the most successful animation studio in the world. In a remarkable turn of events, Apple bought NeXT, and I returned to Apple, and the technology we developed at NeXT is at the heart of Apple’s current renaissance. And Laurene and I have a wonderful family together.

I’m pretty sure none of this would have happened if I hadn’t been fired from Apple. It was awful tasting medicine, but I guess the patient needed it. Sometime life — Sometimes life going to hit you in the head with a brick. Don’t lose faith. I’m convinced that the only thing that kept me going was that I loved what I did. You’ve got to find what you love.

And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven’t found it yet, keep looking — and don’t settle. As with all matters of the heart, you’ll know when you find it. And like any great relationship, it just gets better and better as the years roll on. So keep looking — don’t settle.

My third story is about death.

When I was 17, I read a quote that went something like: “If you live each day as if it was your last, someday you’ll most certainly be right.” It made an impression on me, and since then, for the past 33 years, I’ve looked in the mirror every morning and asked myself: “If today were the last day of my life, would I want to do what I am about to do today?” And whenever the answer has been “No” for too many days in a row, I know I need to change something.

Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure — these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.

About a year ago I was diagnosed with cancer. I had a scan at 7:30 in the morning, and it clearly showed a tumor on my pancreas. I didn’t even know what a pancreas was. The doctors told me this was almost certainly a type of cancer that is incurable, and that I should expect to live no longer than three to six months. My doctor advised me to go home and get my affairs in order, which is doctor’s code for “prepare to die.” It means to try and tell your kids everything you thought you’d have the next 10 years to tell them in just a few months. It means to make sure everything is buttoned up so that it will be as easy as possible for your family. It means to say your goodbyes.

I lived with that diagnosis all day. Later that evening I had a biopsy, where they stuck an endoscope down my throat, through my stomach into my intestines, put a needle into my pancreas and got a few cells from the tumor. I was sedated, but my wife, who was there, told me that when they viewed the cells under a microscope the doctors started crying because it turned out to be a very rare form of pancreatic cancer that is curable with surgery. I had the surgery and, thankfully, I’m fine now.

This was the closest I’ve been to facing death, and I hope it’s the closest I get for a few more decades. Having lived through it, I can now say this to you with a bit more certainty than when death was a useful but purely intellectual concept: No one wants to die.

Even people who want to go to heaven don’t want to die to get there. And yet death is the destination we all share. No one has ever escaped it. And that is as it should be, because Death is very likely the single best invention of Life. It’s Life’s change agent. It clears out the old to make way for the new. Right now the new is you, but someday not too long from now, you will gradually become the old and be cleared away. Sorry to be so dramatic, but it’s quite true.

Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma — which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.

When I was young, there was an amazing publication called The Whole Earth Catalog, which was one of the “bibles” of my generation. It was created by a fellow named Stewart Brand not far from here in Menlo Park, and he brought it to life with his poetic touch. This was in the late 60s, before personal computers and desktop publishing, so it was all made with typewriters, scissors, and Polaroid cameras. It was sort of like Google in paperback form, 35 years before Google came along. It was idealistic, overflowing with neat tools and great notions.

Stewart and his team put out several issues of The Whole Earth Catalog, and then when it had run its course, they put out a final issue. It was the mid-1970s, and I was your age. On the back cover of their final issue was a photograph of an early morning country road, the kind you might find yourself hitchhiking on if you were so adventurous. Beneath it were the words: “Stay Hungry. Stay Foolish.” It was their farewell message as they signed off. Stay Hungry. Stay Foolish. And I’ve always wished that for myself. And now, as you graduate to begin anew, I wish that for you.

Stay Hungry. Stay Foolish.
Thank you all very much.

译文如下:

今天,很荣幸来到各位从世界上最好的学校之一毕业的毕业典礼上。我从来没从大学毕业过,说实话,这是我离大学毕业最近的一刻。
今天,我只说三个故事,不谈大道理,三个故事就好。

第一个故事,是关于人生中的点点滴滴如何串连在一起。

我在里德学院(Reed College)待了六个月就办休学了。到我退学前,一共休学了十八个月。那么,我为什么休学?(听众笑)
这得从我出生前讲起。

我的亲生母亲当时是个研究生,年轻未婚妈妈,她决定让别人收养我。她强烈觉得应该让有大学毕业的人收养我,所以我出生时,她就准备让我被一对律师夫妇收养。但是这对夫妻到了最后一刻反悔了,他们想收养女孩。所以在等待收养名单上的一对夫妻,我的养父母,在一天半夜里接到一通电话,问他们「有一名意外出生的男孩,你们要认养他吗?」而他们的回答是「当然要」。后来,我的生母发现,我现在的妈妈从来没有大学毕业,我现在的爸爸则连高中毕业也没有。她拒绝在认养文件上做最后签字。直到几个月后,我的养父母保证将来一定会让我上大学,她的态度才软化。

十七年后,我上大学了。但是当时我无知地选了一所学费几乎跟史丹佛一样贵的大学(听众笑),我那工人阶级的父母将所有积蓄都花在我的学费上。六个月后,我看不出念这个书的价值何在。那时候,我不知道这辈子要干什么,也不知道念大学能对我有什么帮助,只知道我为了念这个书,花光了我父母这辈子的所有积蓄,所以我决定休学,相信船到桥头自然直。

当时这个决定看来相当可怕,可是现在看来,那是我这辈子做过最好的决定之一。(听众笑)
当我休学之后,我再也不用上我没兴趣的必修课,把时间拿去听那些我有兴趣的课。

这一点也不浪漫。我没有宿舍,所以我睡在友人家里的地板上,靠着回收可乐空罐的退费五分钱买吃的,每个星期天晚上得走七哩的路绕过大半个镇去印度教的Hare Krishna神庙吃顿好料,我喜欢Hare Krishna神庙的好料。

就这样追随我的好奇与直觉,大部分我所投入过的事务,后来看来都成了无比珍贵的经历(And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on)。举个例来说。

当时里德学院有着大概是全国最好的书写教育。校园内的每一张海报上,每个抽屉的标签上,都是美丽的手写字。因为我休学了,可以不照正常选课程序来,所以我跑去上书写课。我学了serif与sanserif字体,学到在不同字母组合间变更字间距,学到活字印刷伟大的地方。书写的美好、历史感与艺术感是科学所无法掌握的,我觉得这很迷人。

我没预期过学这些东西能在我生活中起些什么实际作用,不过十年后,当我在设计第一台麦金塔时,我想起了当时所学的东西,所以把这些东西都设计进了麦金塔里,这是第一台能印刷出漂亮东西的计算机。

如果我没沉溺于那样一门课里,麦金塔可能就不会有多重字体跟等比例间距字体了。又因为Windows抄袭了麦金塔的使用方式(听众鼓掌大笑),因此,如果当年我没有休学,没有去上那门书写课,大概所有的个人计算机都不会有这些东西,印不出现在我们看到的漂亮的字来了。当然,当我还在大学里时,不可能把这些点点滴滴预先串连在一起,但在十年后的今天回顾,一切就显得非常清楚。

我再说一次,你无法预先把点点滴滴串连起来;只有在未来回顾时,你才会明白那些点点滴滴是如何串在一起的(you can’t connect the dots looking forward; you can only connect them looking backwards)。所以你得相信,眼前你经历的种种,将来多少会连结在一起。你得信任某个东西,直觉也好,命运也好,生命也好,或者因果报应。这种作法从来没让我失望,我的人生因此变得完全不同。(Jobs停下来喝水)

我的第二个故事,是有关爱与失去。

我很幸运-年轻时就发现自己爱做什么事。我二十岁时,跟Steve Wozniak在我爸妈的车库里开始了苹果计算机的事业。我们拼命工作,苹果计算机在十年间从一间车库里的两个小伙子扩展成了一家员工超过四千人、市价二十亿美金的公司,在那事件之前一年推出了我们最棒的作品-麦金塔计算机(Macintosh),那时我才刚迈入三十岁,然后我被解雇了。
我怎么会被自己创办的公司给解雇了?(听众笑)

嗯,当苹果计算机成长后,我请了一个我以为在经营公司上很有才干的家伙来,他在头几年也确实干得不错。可是我们对未来的愿景不同,最后只好分道扬镳,董事会站在他那边,就这样在我30岁的时候,公开把我给解雇了。我失去了整个生活的重心,我的人生就这样被摧毁。
有几个月,我不知道要做些什么。我觉得我令企业界的前辈们失望-我把他们交给我的接力棒弄丢了。我见了创办HP的David Packard跟创办Intel的Bob Noyce,跟他们说很抱歉我把事情给搞砸了。我成了公众眼中失败的示范,我甚至想要离开硅谷。

但是渐渐的,我发现,我还是喜爱那些我做过的事情,在苹果计算机中经历的那些事丝毫没有改变我爱做的事。虽然我被否定了,可是我还是爱做那些事情,所以我决定从头来过。

当时我没发现,但现在看来,被苹果计算机开除,是我所经历过最好的事情。成功的沉重被从头来过的轻松所取代,每件事情都不那么确定,让我自由进入这辈子最有创意的年代。

接下来五年,我开了一家叫做 NeXT的公司,又开一家叫做Pixar的公司,也跟后来的老婆(Laurene)谈起了恋爱。Pixar接着制作了世界上第一部全计算机动画电影,玩具总动员(Toy Story),现在是世界上最成功的动画制作公司(听众鼓掌大笑)。然后,苹果计算机买下了NeXT,我回到了苹果,我们在NeXT发展的技术成了苹果计算机后来复兴的核心部份。
我也有了个美妙的家庭。

我很确定,如果当年苹果计算机没开除我,就不会发生这些事情。这帖药很苦口,可是我想苹果计算机这个病人需要这帖药。有时候,人生会用砖头打你的头。不要丧失信心。我确信我爱我所做的事情,这就是这些年来支持我继续走下去的唯一理由(I’m convinced that the only thing that kept me going was that I loved what I did)。

你得找出你的最爱,工作上是如此,人生伴侣也是如此。
你的工作将占掉你人生的一大部分,唯一真正获得满足的方法就是做你相信是伟大的工作,而唯一做伟大工作的方法是爱你所做的事(And the only way to do great work is to love what you do)。

如果你还没找到这些事,继续找,别停顿。尽你全心全力,你知道你一定会找到。而且,如同任何伟大的事业,事情只会随着时间愈来愈好。所以,在你找到之前,继续找,别停顿。(听众鼓掌,Jobs喝水)

我的第三个故事,是关于死亡。

当我十七岁时,我读到一则格言,好像是「把每一天都当成生命中的最后一天,你就会轻松自在。(If you live each day as if it was your last, someday you’ll most certainly be right)」(听众笑)

这对我影响深远,在过去33年里,我每天早上都会照镜子,自问:「如果今天是此生最后一日,我今天要做些什么?」每当我连续太多天都得到一个「没事做」的答案时,我就知道我必须有所改变了。

提醒自己快死了,是我在人生中面临重大决定时,所用过最重要的方法。因为几乎每件事-所有外界期望、所有的名声、所有对困窘或失败的恐惧-在面对死亡时,都消失了,只有最真实重要的东西才会留下(Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything – all external expectations, all pride, all fear of embarrassment or failure – these things just fall away in the face of death, leaving only what is truly important)。提醒自己快死了,是我所知避免掉入畏惧失去的陷阱里最好的方法。人生不带来、死不带去,没理由不能顺心而为。

一年前,我被诊断出癌症。我在早上七点半作断层扫描,在胰脏清楚出现一个肿瘤,我连胰脏是什么都不知道。医生告诉我,那几乎可以确定是一种不治之症,预计我大概活不了三到六个月。医生建议我回家,好好跟亲人们聚一聚,这是医生对临终病人的标准建议。那代表你得试着在几个月内把你将来十年想跟小孩讲的话讲完。那代表你得把每件事情搞定,家人才会尽量轻松。那代表你得跟人说再见了。

我整天想着那个诊断结果,那天晚上做了一次切片,从喉咙伸入一个内视镜,穿过胃进到肠子,将探针伸进胰脏,取了一些肿瘤细胞出来。我打了镇静剂,不醒人事,但是我老婆在场。她后来跟我说,当医生们用显微镜看过那些细胞后,他们都哭了,因为那是非常少见的一种胰脏癌,可以用手术治好。所以我接受了手术,康复了。(听众鼓掌)

这是我最接近死亡的时候,我希望那会继续是未来几十年内最接近的一次。经历此事后,我可以比先前死亡只是纯粹想象时,要能更肯定地告诉你们下面这些:

没有人想死。即使那些想上天堂的人,也想活着上天堂。(听众笑)
但是死亡是我们共同的终点,没有人逃得过。这是注定的,因为死亡很可能就是生命中最棒的发明,是生命交替的媒介,送走老人们,给新生代开出道路。现在你们是新生代,但是不久的将来,你们也会逐渐变老,被送出人生的舞台。抱歉讲得这么戏剧化,但是这是真的。

你们的时间有限,所以不要浪费时间活在别人的生活里。不要被教条所局限–盲从教条就是活在别人思考结果里。不要让别人的意见淹没了你内在的心声。最重要的,拥有追随自己内心与直觉的勇气,你的内心与直觉多少已经知道你真正想要成为什么样的人(have the courage to follow your heart and intuition. They somehow already know what you truly want to become),任何其它事物都是次要的。(听众鼓掌)

在我年轻时,有本神奇的杂志叫做《Whole Earth Catalog》,当年这可是我们的经典读物。那是一位住在离这不远的Menlo Park的Stewart Brand发行的,他把杂志办得很有诗意。那是1960年代末期,个人计算机跟桌上出版还没出现,所有内容都是打字机、剪刀跟拍立得相机做出来的。杂志内容有点像印在纸上的平面Google,在Google出现之前35年就有了:这本杂志很理想主义,充满新奇工具与伟大的见解。

Stewart跟他的团队出版了好几期的《Whole Earth Catalog》,然后很自然的,最后出了停刊号。当时是1970年代中期,我正是你们现在这个年龄的时候。在停刊号的封底,有张清晨乡间小路的照片,那种你四处搭便车冒险旅行时会经过的乡间小路。

在照片下印了行小字:求知若饥,虚心若愚(Stay Hungry, Stay Foolish)。

那是他们亲笔写下的告别讯息,我总是以此自许。当你们毕业,展开新生活,我也以此祝福你们。

求知若饥,虚心若愚(Stay Hungry, Stay Foolish)。
非常谢谢大家。

IE css bugs汇总

本文翻译是 http://haslayout.net/css/

目前,这个网站上包含了 46 个“普通的Bug” , 5个“布局方面的Bug” ,6 个“可以绕开的Bug” 以及 1 个“IE崩溃的Bug”,所有的这些Bug有58个指南和70个解决方法。

这个列表目前更新到:2009年8月19日,周三 ,15时38分47秒。

最新发表的教程:该网站包含44 IE6 bugs, 28 IE7 bugs 和19 IE8 bugs.

下面是所有的bug列表,你可以点击每个BUG名的链接查看更详细的说明和解决方法。

IE的CSS Bug:普通Bug
这部分 IE 的 bug 是比较普通的无法归到其它种类,或是同时属于多个种类的Bug。

General Internet Explorer CSS Bugs解决方法名称IE的版本描述Image Label Focus Bug(图片label bug)IE8, IE7, IE6当label中有img的时候无法触发点击选中form元素事件.No Auto-Margin Center on Buttons Inconsistency (设置margin auto的button没有居中)IE8如果给像button这样的标签(如button input[type=”button”] input[type=”submit”])设置{ display: block; margin-left: auto; margin-right: auto; }如果不设置宽度的话无法居中。Incorrect Float Shrink-Wrap Bug (不正确的浮动伸展布局)IE7, IE6连续浮动的元素并且设置clear属性没法自动伸展。Document Scrollbars Overflow Inconsistency (文档滚动bug)IE7, IE6不在html标签上设置overflow或许会影响到body上面的overflow。Float Squeeze Weird Gap Bug (连续浮动元素bug)IE7, IE6A gap appears between last and second last floated elements that are stacked vertically.Float Squeeze Duplicate Last Character Bug (连续浮动字符出现重复字符)IE7, IE6这个和上面的解决方案都差不多,它是通过加一个宽度,而这个是通过给浮动字符加一个position:relative;Empty Element Height Bug (空元素高度bug)IE7, IE6有layout的空元素获得了高度Form Control Double Margin Bug (表单元素双margin bug)IE7, IE6input和textarea或许会继承父元素的水平的marginIE7 1px Dotted Border Appears As Dashed Bug (ie7的1px dotted 边框变成dashed边框的bug)IE7当设置了1px dotted边框后,有一个边框的宽度大于1px
的话其它为1px边框会变为dashed的样式Relative Overflow Failure Bug(overflow bug)IE7, IE6当设置了overflow:hidden或auto的元素,如果子元素设置了相对定位,overflow就不起作用了,
表现的是visible的样式,解决方法是给父元素加一个position:relative;IE7 “Broken” :hover Absolute Bug (ie7的坏的:hover 绝对定位bug)IE7当子元素设置了absolute并且通过设置left top 等来通过:hover时改变其显示位置时将会不起作用如果他们不再父元素的可视范围内,解决方法是给其加上margin-left:0%;Button Background Shift On :active Bug(当:active时Button背景偏移)IE8给button设置:active时背景会做偏移,可以通过设置:active时的-ms-background-position-x和-ms-background-position-y来改变这个偏移。Ignored :focus Bug IE8A ruleset, selector of which contains :focus that is followed by another simple selector, is ignoredInvisible Hover Border Bug (:hover边框消失bug)IE8当设置了outline的元素后,再设置:hover的时候,如果设置边框的话,将会不显示Percentage Padding Margin Bug (百分比padding垂直margin bug)IE8当父元素设置了百分比的padding,子元素有垂直的margin的时候,
就好像父元素被设置了margin一样,解决方法是给父元素加一个overflow:hidden/autoImage Float Bullet Chaos Bug (图片浮动List标记错位bug)IE8当List里面有浮动的image时,List标记显示的位置跑在里面了,可以通过使用背景图片代替List自带的标记来解决。Non-Inherited TH Text-Align Bug (TH没有继承Text-Align属性的bug)IE8当给table设置text-align时,TH没有继承样式,可以通过给TH设置text-align:inherit;来解决IE8下这个丑陋的bug。32 Styles Limitation (32个Style限制)IE8, IE7, IE6在32个”style”方法(style, link, @import)后浏览器会忽略后面的样式Hover White Background Ignore Bug(白色背景hover bug)IE7background 不会因为 :hover而改变,给hover设置background-color:#ffffff;时,背景不会改变,解决方法是设置background:#ffffff;IE7 Child Selector Comment BugIE7一个 selector 包含了一个子的selector,如果后面跟着一个注释,则会被完全忽略。Star HTML Bug (* html bug)IE6* html [selector]在ie6下通常不会被忽略,这个bug通常被用来作IE6的hack使用。IE6 !important Ignore BugIE6!important 关键字会忽略,important之后设置同样的规则后important会被忽略,这个bug也常被用来指定ie6的样式。PNG Image and Background Color Mismatch (png图片和背景颜色不一致)IE8 ,IE7,IE6设置背景颜色和png图片背景同样的颜色代码最后表现不一致,原来是因为ie支持“PNG Gamma profiles”,解决方案是通过一个pngcrush程序来优化图片。而他们本来是一致的。IE认为这是他一个Feature。太可笑了。No Auto Margin Center Pseudo-BugIE8 ,IE7,IE6如果把margins 设置成 `auto` ,IE不会把组件放置在中间的位置。所有的浏览器都会,只有IE不会。给block元素设置margin auto无法居中,出现这种bug的原因通常是没有Doctype,然后触发了ie的quirks mode,加上就可以了。:first-line !important Rule Ignore Bug(:first-line/:first-letter里的!important会忽略)IE8如果在伪class :first-line 内使用!important,那么其所有定义会被忽略。:first-letter Ignore BugIE6当:first-letter前面有逗号的时候ie6会忽略这条规则,解决方法是将:first-letter放到最后。:first-letter !important Rule Ignore BugIE8如果在伪class :first-letter内使用!important,那么其所有定义会被忽略。Partial Click Bug v2E7,IE6设置了整个区域是可以点击的,但在IE中只有文本可以点击。Staircase BugE7,IE6浮动的元素排序起来就像一个楼梯。Disappearing List Background BugIE6B

  • ,
    ,

    没有背景。noscript Ghost BugIE8,IE7,IE6
  • 远方-许达然

            似乎远方总是使人向往的。

      其实有美的远方,有丑的远方。
    越远越朦胧,越朦胧越神秘。那神秘常使我们幻想:远方的平房变成宫殿,远方的小溪变成大江,远方的强悍变成温驯,冰雪封蔽的远方变成绿土。一些最坏的形容词,也可能被加在我们所不喜欢的远方。
    人们总是爱制造远方,虽然昔日的远方依旧是今日的远方。莫尔的“乌托邦”,培根再造的New。远方的梦土也许有神仙,但徐福入海未回,秦始皇死了,求仙药的梦却未死,依旧使后代帝王失眠。可怜东方朔走遍了远方,依然不见可爱的神仙。神仙渺而不可慕,因为神仙压根儿就只在我们心里的远方。
    茫茫大海,浩瀚似无岸。那远方的神秘,诱惑了靠海的民族而遨游海上,从事探险。征服与掠夺,给受海水冲击的国家的文明增添了一些色彩。出瀛海又有瀛海,远方的海像女妖,迷人也凶狠。东汉时班超的一位部将甘英,曾想从条支渡海到大秦(东罗马?),但大海茫茫似栖息着死神,而打断了他的念头,甘英壮志未遂,和亚历山大未渡印度河到他向往的远方一样,常使我惋惜。
    山是纵的远方。有限的高峻是无限的蛊惑,长年的沉默是不变的磁力,山不迷人人自迷,总是使人自动地往它那里去;登高山又有高山,登不完的高山登不完的向往。这纵的远方的凛然曾磨削人的斗志,使古老的印度民族在无助的茫然中孕育悲观的思想。这纵的远方的悠然常是人们灵魂的安慰。怏怏的屈原一直向往昆仑。
    跛脚的拜伦以眺望写出对山的感情。对一个爱纵的远方的人来说,只能做山下的青草,而不能是山上的云,也是悲哀的了。
    每个民族有每个民族的远方,而陶醉在似有似无的梦境里。列子汤问篇造了一个终北国,虽不是天堂,却使周穆王去了以后乐陶陶,回来后迷糊了好几个月才恢复正常,使人神往。天真的希腊人也在他们的北方造一个Hyperboreans的国,在南方造个Ethiopia,使后世的人糊里糊涂地考证。好似过了两千多年后,我们忽然找到了古人所向往过的远方了。当然,好幻想的古人,也想象一些丑恶的远方,只是不愿提起而已。
    东方!东方这个神秘,至少有二千年,是欧洲人的梦魇。中国曾许久是西洋人心灵的寄托,想象中的天堂,而使他们一直试图在探知这遥远的东方。东方,东方,苍老的东方虽早已不再是西洋人的天堂,但仍是他们的远方,像龙一样,依然神秘,以一股莫名的力量向西方招引,引来了一个青年研究我国的历史,而且兴奋地向我说:“我终于来到了这里,来到了从小就向往的东方。”
    一个最真最善最美的远方一直使人向往,那是天堂。对天堂的向往曾支配了西洋的中古史,而使人们不惜牺牲世上的幸福,以通过上帝启示的窄门进那远方。可是一直没有人从天堂回来,因此到现在人们还在向往天堂,而且天堂似乎越来越美了。地狱也是最远的远方,想到它,就像暴风雨前乌云的阴影覆罩着,使我们有着莫名的恐惧。有人向往天堂而做好事,有人怕进地狱而做好事。远方,常常冥冥地在驱策着人!
    血液里似乎遗传着流浪的鲜红,几乎每个人有远行的冲动。雪莱的回忆:“我曾是远方原野的浪人,我曾航过大河。”也几乎是每个人的梦。远方的漫游,虽然掺着乡愁,却一直在开展人们的胸怀,成熟人们的思想。古希腊的两位史学家希罗多德与修西底德斯和我们的司马迁一样曾漫游远方,而写出那么有气魄的历史!年轻时远游埃及,看到了与雅典不同的另一型态的文化,使柏拉图开拓了视野,而影响到他“理想国”的著作。人间到处可以找到异乡人,远方的憧憬把他们带到异乡,甚至在异乡成功了他们的事业。300多年前,英国有个年轻人离开了故乡来到他的远方伦敦,给了我们不朽的礼物——莎士比亚的戏剧。
    “当我长大了,我自己要去那里。那地方比起我们这里来是几千倍的美丽,那里根本没有冬天,你一定同我去,好吗?”在席笃姆的《茵梦湖》里,那个小赖因哈向小伊丽莎白这样说,真是写出了许多小孩子对远方的梦。还有什么比小孩子的梦境更天真更美?“我去。”小女孩应和着小男孩的梦,“但妈得同我们去,你妈也去。”“不。”他这样回答,“那时他们太老了,不能同我们去了。”
    “可是我不能自己去。”
    “噢,你可以的,那时你是我太太,别人就跟这件事不相关了。”
    如果有人卖梦,小孩子也许要买长大的梦。小孩子期望自己长大,而可以无羁地去远方的梦土远游。这虽是小说里天真的对话,其实也是证实人生的写照。
    从童年的梦里醒来,年轻人有着遥遥的前程,遥遥的前程是一连串的远方。一切对他好像那么远,连死亡对他也是远的。也许他一无所有,却至少有一股澎湃的热血与勇气。也许他不知走向哪里,却有着走向远方的决心。远方也许是凶恶的敌人,但他依然向前。远方也许有暴风,有狂澜,但他依然把船向前驶去。远方也许像非洲的莽林,满布死亡,但他依然走近。远方也许是荒漠,但乐园是开拓了的荒漠,他要去,去那远方。还有什么喜悦比抵达梦土更使人歆羡?——那第一批到达新英格兰的清教徒,看到的梦土虽荒凉,却高兴得跪下来感谢上帝。也许他在远方造乐园。也许他又觉得老家是亲密的远方。也许他死在远方。也许他从远方回乡。
    也许他凯旋。即使手上一无所得,他的心里仍有收获:有一天,可以告诉别人,他曾去过远方,那很少人去过的荒漠!
    幻想可以点缀生命,但只是远方的云不能构成天空。向往可以活泼生命,但不是人生。我们总不能成天幻想远方,只是向往,只是想往,而抛弃现实。曾看过赛克爵士写的《探险史》,那是人类从古到今,用行动去实现抵达远方的奋斗记录。
    如果只是向往,远方依旧是远方,向往永不能成为历史。很久很久以前,有个天文家总是全神观望天空,有一次不小心跌到井里去了。他呼救后邻人跑来,知道了他落井的原因后,就跟他说:“你怎么只注意天上的东西而不注意地上的呢?”伊索的这一则寓言,真的是要告诉我们些什么的。
    醉看远山,远山更美。幻想使人沉醉,我们常醉看远方而自以为清醒。远方不一定如想象中的那么绮丽,或那么丑恶。如果前秦的军队走近一点,也许不会把草木误认做兵。如果我们登上了月球,也许发现它并不如远在地球上看时那么漂亮,那时反而看地球才漂亮哪!
    无论我们到哪里,天空总在上面。远天的星辰以常年的静默逗人遐思。我们发现一颗星,却另有一颗星。如果人生是无涯的嵯峨山脉,那么活着就是一连串对远方的向往与朝圣,我们到了一个远方,却又有另一个远方在呼唤。无穷的远方,有限的生命,使人抱志饮恨。一个刚会走路,在生命黎明的小孩,也会有他的远方;一个走过长程,进入生命黄昏的老人,仍会怀抱着他的远方。多少英雄要以有限的生命去征服无穷的远方,但远方依旧微笑,而英雄却一个个倒下。圣海伦岛曾经是年轻的拿破仑的远方,却也是老迈英雄倒下的孤岛。你,人生旅程上的英雄,有一天也会在远方的微笑里倒下——那不是悲剧,那是命运。
    总是有许多人愿舍弃眼前的幸福到远方去,就让他们去吧!不必用佳肴把志在高空在鸟桎梏在笼子里,尽管笼子多大,笼子不是天空。
    或美或丑,对你,远方仍是温柔的有力的挑战,你去吗?

     

    许达然(1940年9月25日—),原名许文雄,台湾台南市人,是一位知名的台湾历史学家与文学作家。

    许达然是许筱华先生和何富女士的长子,在台南市进学国民学校(现台南市中西区进学国民小学)读小学时,深受邓正宗老师的关怀照顾和言教身教,初中就读台南一中初中部,台南市长荣中学高中部毕业后,考入台中市的东海大学历史学系,师从王德昭、杨绍震、蓝文徵、黎烈文等教授,本科毕业服完预备军官役,留在学校担任助教,得奖学金到美国哈佛大学读书,获硕士学位,在美国芝加哥大学得博士学位,1969年起在美国西北大学(美国伊利诺州)教书,1980年代也曾到英国牛津大学做研究,主要学术专长是台湾史,特别是台湾社会史、台湾文化史。   他也是以汉语写作的现代文学作家和诗人,创作现代诗和散文,共出版17本文集和1本诗集,部分作品翻译成英文、法文、德文、日文、韩文.

    window showModalDialog 在IE6 IE7 高度(height) 问题

    在IE6测试的时候发现,window.showModalDialog()高度有问题,原来在IE7里能看到的按钮,但在IE6里不能显示出来找了相关的资料发现,原来IE6跟IE7的高度算法不一样的

    IE6 计算高度是整个窗视体计算(包括title和status)

    IE7 计算高度是内容窗体来计算  (不包括title和status)

    如图所示:


     

    具体代码分析:

    因为窗口高度不对,所以我们得根据IE的版本类型来显示不同的窗口(showModalDialog)

    代码片断:

    代码

    var ua=navigator.userAgent.toLowerCase();//客户端浏览器信息
    var size=””;
    if(window.ActiveXObject)//判断IE浏览器
    size=ua.match(/msie ([\d.]+)/)[1];//得出IE的版本大小
    if(size==”6.0″)
    {
    window.showModalDialog(‘DealStepOne.aspx?ID=’+v2+’&t=’+odate.getTime(),’temp’,’dialogWidth:905px;dialogHeight:545px;dialogLeft:300px;resizable:no;scroll:no;status=0;’);
    }
    else
    {
    window.showModalDialog(‘DealStepOne.aspx?ID=’+v2+’&t=’+odate.getTime(),’temp’,’dialogWidth:905px;dialogHeight:525px;dialogLeft:300px;resizable:no;scroll:no;status=0;’);
    }