cvs: pearweb /include pear-format-html.php
| From: | David Coallier | Date: | Fri, 23 Mar 2007 23:44:11 +0000 |
| Subject: | cvs: pearweb /include pear-format-html.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-45395@lists.php.net to get a copy of this message | ||
davidc Fri Mar 23 23:44:11 2007 UTC
Modified files:
/pearweb/include pear-format-html.php
Log:
feature #10477 fix. This is the real unobstrusive way of doing things
in nowadays javascript window.onload. This covers all major browsers
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-format-html.php?r1=1.198&r2=1.199&diff_format=u
Index: pearweb/include/pear-format-html.php
diff -u pearweb/include/pear-format-html.php:1.198 pearweb/include/pear-format-html.php:1.199
--- pearweb/include/pear-format-html.php:1.198 Sat Mar 10 22:25:15 2007
+++ pearweb/include/pear-format-html.php Fri Mar 23 23:44:10 2007
@@ -15,7 +15,7 @@
+----------------------------------------------------------------------+
| Authors: |
+----------------------------------------------------------------------+
- $Id: pear-format-html.php,v 1.198 2007/03/10 22:25:15 davidc Exp $
+ $Id: pear-format-html.php,v 1.199 2007/03/23 23:44:10 davidc Exp $
*/
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler');
@@ -131,11 +131,7 @@
<link rel="alternate" type="application/rss+xml" title="RSS feed"
href="http://<?php echo
htmlspecialchars($_SERVER['HTTP_HOST']); ?>/feeds/latest.rss" />
</head>
-<body <?php
- if (!empty($GLOBALS['ONLOAD'])) {
- print 'onload="' . $GLOBALS['ONLOAD']. '"';
- }
-?>>
+<body>
<div>
<a id="TOP"></a>
</div>
@@ -323,6 +319,27 @@
</td>
</tr>
</table>
+<!-- Onload focus to pear -->
+<?php if (isset($GLOBALS['ONLOAD'])): ?>
+<script language="javascript">
+function makeFocus() {
+ <?php echo htmlspecialchars($GLOBALS['ONLOAD']); ?>
+}
+
+function addEvent(obj, eventType, functionCall){
+ if (obj.addEventListener){
+ obj.addEventListener(eventType, functionCall, false);
+ return true;
+ } else if (obj.attachEvent){
+ var r = obj.attachEvent("on"+eventType, functionCall);
+ return r;
+ } else {
+ return false;
+ }
+}
+addEvent(window, 'load', makeFocus);
+</script>
+<?php endif; ?>
<!-- END FOOTER -->