Y星人の工作語錄

別理我, 我只是一個愛發勞騷的Y星人

6月
02

IE8 problem - cookie , form field - transparent and more

Posted by YuanYuan under browser, jQuery, javascript

Some user tell me, he has some problem with IE8. yeah, what’s going on ?

1.Cookie
when user login then click some button(must be login fn), still alert , “you’r not login!!!” , yeah! what’s wrog ? IE6, IE7, FF2+ works fine, why IE8 get this problem ? I google it get the answer. because IE8 security issue, when you set cookie , you must set domain name. if you don’t, you can’t get correctly cookie value. haha. IE8 tell you, you must write right cookie format set.

jquery cookie plugin example:

  1. var cookie_options = { expires: 30, domain: 'my.happy.com'};
  2. $('a#btn-login').click(function() {
  3.      $.cookie("_clk_cookie", 1, cookie_options);
  4.         return false;
  5.     });

2.background:transparent, with form field.
In login form, your cursor can through the password field , click the under google map.
It’s fun. IE6, IE7, FF2+ works fine. but IE8 just through the field. why ? because I set some css is,

  1. #login form input{background:transparent}

IE8 through the field. nerver see before. haha. how to fix ?
Mark or delete this.

3.different height ?
I set some navgation height, IE6, IE7 same nav height, but IE8 different. I don’t know why ? so, I google it find some fix way. IE8 Hacks.

  1. #nav {
  2.     height: 75px\9; /* all IE */
  3.     height: /*\**/95px\9; /* IE8 only */
  4. }

4.jQuery corner plugin problem.
version 1.91(9/21/2007) on IE8 get some layout problem. you need upgrade to version 1.96 (11-MAY-2009)

I think , IE8 still have some problem with our web.

IE8 sUxxxs ? hahaha. maybe or not.

5月
26

Javascript equivalent of PHP’s print_r() function

Posted by YuanYuan under javascript

sometimes , we need to debug array data, any way to do ? document.write ? or innerHTML ?
you can try this.

Javascript equivalent of PHP’s print_r() function

javascript print_r or var_dump equivalent

javascript debugging print rvar dump in javascript like php

5月
26

TaffyDB so good!(Taiwan’s theater info on the Googlemap)

Posted by YuanYuan under javascript

I have a project to make Taiwan’s movies theater show on Google Map. I got plain text data.
How do I convert this data on Googlemap?
1. I write a parse function to convert this plain text data to json string.
2. convert this json string to json format.
3. set this json to Taffy DB.
4. now you can useing SQL Tutorial like. example: here
5. I try to combined jQuery, jquery.fancybox, a little php, ajax, Json. mapiconmaker.js to do this.

now I finish Taiwan’s theater info on Google Map prototype. show example later.
in this project I get a little problem with php regular expression.

I try to parse plain text data, but some data format is movie_photos=http://xxx.com.tw/online/image.do?url=images/TWN_MOVIE/a12345.jpg
use

  1. list($qKey, $qVal) = preg_split("/=/", $element[ 'value' ]);

but get 2 item ? I just need only movie_photos=xxxxxxx until the end of line.

finally I fund this function set then fixed this problem.

  1. list($qKey, $qVal) = preg_split("/=/", $element[ 'value' ], 2, PREG_SPLIT_DELIM_CAPTURE);

why I use the TaffyDB ?
I think, if your data not too much, you can get all data at once. not alaways connect to server get data again. and Taffy DB have SQL tutorial like, support JSON, faster, good JSON control function…, that’s useful for me.

Taffy DB, was developed by Ian Smith.

what is Taffy DB ?(A JavaScript database for your browser)
Taffy DB is a free and opensource JavaScript library that acts as thin data layer inside Web 2.0 and Ajax applications.

What makes it cool:
10K file size!
Simple, JavaScript Centric Syntax
Fast
Easy to include in any web application
Compatible with major Ajax libraries: YUI, JQuery, Dojo, Prototype, EXT, etc
CRUD Interface (Create, Read, Update, Delete)
Sorting
Looping
Advanced Queries