For the automation of maintenance of mechanical facilities and devices, anomalous sound detection from machines has been explored. For these years, methods by machine learning and deep learning have been proposed for anomaly detection in various fields. Some deep-learning-based works calculate an anomaly score based on reconstruction errors obtained from an autoencoder model. However, the performance may not be sufficient, depending on characteristics of machines. In this study, we propose a method for detecting anomalous sounds using an autoencoder model with an attention-based mechanism. Given multiple frames of the log-scale mel spectrogram with a missing frame, our model computes the reconstruction error between an predicted frame and the removed frame as an abnormal score. We conducted experiments to compare our scheme to conventional ones, with visualizing attention weights. Our method achieved better performance, and it is found the missing frame can be well predicted using surrounds frames emphasized by the attention model. It is also found our approach can perform well independent on kind of machines and the number of input frames.