Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Disappearence of the buttons(Images)

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All
I have coded a jsp which generates HTML. The HTML has a header with content= no cache. The html has a FORM that has a two images img1, img2 apart from some text items. Once you click the image (looks like a button) the form will be submitted. Before submitting the form the html runs a javascript which swaps the img1 to img2 which will give an appearence as though the image(button) has been pressed/not pressed. The javascript is coded on onMouseDown & onMouseUp respectively. The javascript basically swaps the image back & forth.
In netscape it works perfectly alright. But in IE sometimes (not always) the image disappears. The user cannot see the button(s)sometime. But if you bring the mouse at the position of the button and click the form gets submitted.
I am not sure why this happens. Is it because no-cache in the header means it has download the image each and every time and in that event it could not download based on IE specification or someother reason.
Can any one help me in this regard.
Thanks a bunch
Chandar
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first guess would be yes, it is because of the no cache statement. Since you have this, it has to download the images, and if the page loads, but the onMouseDown image has not downloaded yet, then you will get a blank image like that. Since you said this happens sometimes and not always, I would think that is your problem. I would do two things, get rid of the no cache statement, unless you have other reasons to keep it there, and preload your images in javascript, so it won't load the page until all of the images are preloaded.
That should fix the problem, if it doesn't, try pasting some of your code and we can take a look at it then.
By the way Chandarv, we have a naming policy here at the Ranch, and your name doesn't comply. Check out http://javaranch.com/name.jsp for more information. Please re-regester with an appropriate name.
Thanks,
Bill
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think its doing that bcz its trying to download the second image on the run and that is why it disappears...try declaring the images like this in the javascript (before the body tag of the html)
img2=new Image;
img2.src="img2.jpg";
i think even with no cache this should get the image before it loads the body
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help. I implemented with new Image and it worked.
Bill,
BTB I registered with new user name which complies with the Javaranch Standards
Chandar
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your cooperation Chandar.
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic