Getting Error message “Object doesn't support property or method 'attachEvent'” in IE11 to call SAP system

Note that attachEvent is no longer supported in IE11 and you should use addEventListner that can be used to bind specific function to an event.

In older versions of IE, you can use like this:

object.attachEvent(event, pDisp)


event [in]

Type: String
A String that specifies any of the standard DHTML Events.

pDisp [in]

Type: Object
The Pointer that specifies the function to call when the event fires.
Return value
Type: Boolean
Boolean returns any of the below value:
Return value     Description
True                   The function was bound successfully to the event.
False                  The function was not bound to the event.

Note that IE has included support for addEventListener from IE9 and above only. Now if you want to support IE8, I would suggest you to use some cross-browser library like jQuery to bind event handlers.
For more information about addEventListener, refer below Microsoft site link: