updated javascript code for html-display