Mobile IE6 Standard ASP.NET - onblur not working for , problems with getAttribute

来源:http://www.imcoder.org/mobile/210544.htm

 

Q:

Hi all,

I have a simple ASP.NET 2 page with a TextBox control, in the PreRender I set ClientSide events:-

                Response.Attributes.Add("onchange", "javascript:alert('Changed');");
                Response.Attributes.Add("onfocus", "javascript:alert('Has Focus');");
                Response.Attributes.Add("onblur", "javascript:alert('Lost Focus');");

In the destop browser everything is fine, all events fire as expected.

When I open the same page from a PDA running Mobile Windows Professional 6, only the
onfocus and onchange events fire, onblur never does.

The Internet Explorer Mobile Reference page tells me that these, and only these events can be caught in the mobile browser but I can't make it work.


RadioButton controls appear to work as expected for all three events - have had a chance to test the other controls yet.

 

I can see that the attribute is appearing in the tag (using the getAttribute method) and the attached script looks fine.

 

There also appears to be a problem with the getAttribute command in general.


According to the Internet Explorer Mobile Reference the method should return a null if the attribute is not found, instead an exception is thrown, but without any details attached to the error object.


Here's the JS function that I'm using to check :-


        function findAttributes(control) {
            try {
                alert ('in findAttributes');
                //alert ('onfocus = ' + control.getAttribute('onfocus'));
                alert ('onblur = ' + control.getAttribute('onblur'));
                alert ('about to get wrongattribute');
                var attrib = control.getAttribute('wrongattribute');
                alert ('got wrongattribute');
                //if (control.getAttribute('wrongattribute') == null) {
                //    alert ('Attribute not found');
                //}
                //else
                //{
                //    alert ('wrongattribute = ' + control.getAttribute('wrongattribute'));
                //}


                controlCurrent = control;
                if (control.type == 'text')
                {
                    alert ('this is a text control');
                }
                else
                {
                    alert ('this is NOT a text control');
                }
            }
            catch(e) {
            catch(e) {
                alert ('Error - ' + e.description);
                alert ('Error - ' + e.message);
                alert ('Error - ' + e.name);
                alert ('Error - ' + e.number);
                alert ('Error - ' + e.toString());
            }
        }


Any help greatly appreciated.

 

Cheers,

 

Duncan

A:

Hello Spence,

it would be interesting to read something about the onblur issue from the IEMobile team.

posted @ 2008-08-09 15:36  KK in cnblog  阅读(222)  评论(0编辑  收藏  举报