tags:

views:

166

answers:

2

hi,

I have a blur function already attached to my dropdown, now I want to call another function onchange after my blur function is called in javasript.

<select onchange="CheckAccommodation(this)" onblur="return UpdateFormSelect('UpdatePrice.aspx', 'BookNow_accommodation1', 'select', 'BookNow_accommduration');javascript:test()" id="BookNow_accommodation1" name="BookNow:accommodation1">

Now I want to call my javascript:test() after the blur is done

Please suggest!

Thanks.

Best Regards, Yuv

+2  A: 
TheVillageIdiot
Many Thanks, please have a look to my code added in question.
MKS
A: 

Now I want to call my javascript:test() after the blur is done

Then just remove the ‘return’ on the first statement, allowing it to fall through to the second:

onblur="UpdateFormSelect('UpdatePrice.aspx', 'BookNow\_accommodation1', 'select', 'BookNow\_accommduration');test()"

You could put return test(), but actually onblur doesn't need to return anything. <a onclick> often needs to return false to stop the link being followed, but other than that you often don't need any return value from an event handler.

It's also a bit of a mouthful to put in an event handler. You might benefit by breaking the JavaScript out:

<select id="BookNow_accommodation1" name="BookNow:accommodation1">
    ...
</select>

<script type="text/javascript">
    var acc1= document.getElementById('BookNow_accommodation1');
    acc1.onchange= function() {
        CheckAccommodation(this);
        // or just move the body of CheckAccommodation here
    };
    acc1.onblur= function() {
        UpdateFormSelect('UpdatePrice.aspx', 'BookNow_accommodation1', 'select', 'BookNow_accommduration');
        test();
    };
</script>
bobince