diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-09-09 22:52:38 -0400 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-09-09 22:52:38 -0400 |
commit | d7ae0ed4fd755ebad0788a17d0f2fb6a6ca9d63b (patch) | |
tree | df58e167fe84f49af11edce4d0a7ebc34e480510 /lib/htmloutputter.php | |
parent | beae3db41375879e725af053edf8041bbd76ac8c (diff) | |
parent | aecdba1ded89b45f32d0b7615ce6b103478403dd (diff) |
Merge remote branch 'laconica/0.8.x' into 0.9.x
Conflicts:
lib/omb.php
Diffstat (limited to 'lib/htmloutputter.php')
-rw-r--r-- | lib/htmloutputter.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 8ad7dc20f..aa01f6b1d 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -412,4 +412,29 @@ class HTMLOutputter extends XMLOutputter $this->element('p', 'form_guide', $instructions); } } + + + /** + * Internal script to autofocus the given element on page onload. + * + * @param string $id element ID, must refer to an existing element + * + * @return void + * + */ + function autofocus($id) + { + $this->elementStart('script', array('type' => 'text/javascript')); + $this->raw(' + <!-- + $(document).ready(function() { + var el = $("#' . $id . '"); + if (el.length) { + el.focus(); + } + }); + --> + '); + $this->elementEnd('script'); + } } |