Thursday, March 15, 2007

Javascript cell.innerText problem

In JavaScript, cell.innerText is deprecated. If you use it, you may get problem when browsing. I discovered this when I browsed Nanfang daily (my favorite Chinese news publisher) every week. However, the PDF downloading page works with IE only. This is annoying to me, because I always use Firefox. After a short study, I look found the problem is the old JavaScript. Their script codes hasn't been updated for a long time~~. They used the outdated innerText for cell object in JavaScript:
cell.innerText = daily;

It doesn't work with Firefox and should be changed to
cell.innerHTML = daily;

Show your own icon on the brower

Change '[' and ']' to '<' and '>' by yourself. Blogger doesn't allow them in the post, even using code positions.
[html]
[head]
[link rel="icon" href="/images/favicon.ico" type="image/png"]
[/head]
...

Monday, March 12, 2007

Handling form data at the server side

  • PHP
If your form is submitted by 'GET' method, the data is sent via url like this http://mydomain.com/test.php?foo1=val1&foo2=val2 At the server side, you can get the string by global variables _SERVER['QUERY_STRING'].
example: $a = explode('&', $_SERVER['QUERY_STRING']); $i = 0; while ($i < count($a)) { $b = split('=', $a[$i]); echo 'Value for parameter ', htmlspecialchars(urldecode($b[0])), ' is ', htmlspecialchars(urldecode($b[1])), " \n"; $i++; } ?>