Javascript ~ Check HTML element/object is exists

如果要對這物件做動作~~~

但想先確定它到底存不存在~~~~就~

var element = document.getElementById("something");
if (element != null)
{
// Code here when the Element Exists.
}

http://bytes.com/topic/javascript/answers/479963-check-if-object-exists

沒有留言: