how do hide an image at runtime using javascript?

In my html5 file in windows 8 modern app I have two image tags defined.name of the first image is previous and name of other image is next. When the application loads for the first time I want 'previous' image not to be displayed and 'next' image should be displayed.

I haven't assigned any source to both the images.and when the application loads for the first time I assigned some source to 'next' image and it loads successfully.but the 'previous' image icon with square shape is still shown.i want it to display nothing here.And also later point I want to hide the 'next' image completely.

in both the cases the square shape is shown when I am assigning no source.

any suggestions on how to hide the image so that nothing would be displayed in place of it.

Answers


What about setting their style.visibility attribute?

var mImg = document.getElementById('idOfFirstImage');
mImg.style.visibility = "hidden";

mImg = document.getElementById('idOfSecondImage');
mImg.style.visibility = 'visible';

Need Your Help

disable click event handler for a duration of time

javascript jquery bind settimeout unbind

I've already looked at similar questions but the answers provided involve buttons and not div elements. When I click the div element with id click, the click event handler is disabled by unbind() and

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.