MDL-14439 IE and Opera fire the onchange when ever you move into a dropdwown list with the keyboard - this changes fix the problem. Merged from 19.

This commit is contained in:
jerome
2008-05-02 02:45:18 +00:00
parent 5ddb20aaeb
commit 52cc2b7af8
2 changed files with 13 additions and 2 deletions
+2
View File
@@ -1,4 +1,5 @@
<?php /// $Id$
/// Load up any required Javascript libraries
if (!defined('MOODLE_INTERNAL')) {
@@ -24,6 +25,7 @@
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/overlib/overlib_cssstyle.js"></script>
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/cookies.js"></script>
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/ufo.js"></script>
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/dropdown.js"></script>
<script type="text/javascript" defer="defer">
+11 -2
View File
@@ -1,5 +1,6 @@
<?php // $Id$
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
@@ -1110,8 +1111,16 @@ $targetwindow='self', $selectlabel='', $optionsextra=NULL) {
$selectlabel = '<label for="'.$formid.'_jump">'.$selectlabel.'</label>';
}
$output .= '<div>'.$selectlabel.$button.'<select id="'.$formid.'_jump" name="jump" onchange="'.$targetwindow.'.location=document.getElementById(\''.$formid.'\').jump.options[document.getElementById(\''.$formid.'\').jump.selectedIndex].value;">'."\n";
//IE and Opera fire the onchange when ever you move into a dropdwown list with the keyboard.
//onfocus will call a function inside dropdown.js. It fixes this IE/Opera behavior.
if (check_browser_version('MSIE') || check_browser_version('Opera')) {
$output .= '<div>'.$selectlabel.$button.'<select id="'.$formid.'_jump" onfocus="initSelect(\''.$formid.'\','.$targetwindow.')" name="jump">'."\n";
}
//Other browser
else {
$output .= '<div>'.$selectlabel.$button.'<select id="'.$formid.'_jump" name="jump" onchange="'.$targetwindow.'.location=document.getElementById(\''.$formid.'\').jump.options[document.getElementById(\''.$formid.'\').jump.selectedIndex].value;">'."\n";
}
if ($nothing != '') {
$output .= " <option value=\"javascript:void(0)\">$nothing</option>\n";
}