wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Changing the curser while the page is loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Changing the curser while the page is loading" Watch "Changing the curser while the page is loading" New topic
Author

Changing the curser while the page is loading

Rahul Ashar
Greenhorn

Joined: Apr 01, 2007
Posts: 20
Hi All,

I have a jsp page loaded according to the user selection of drop down menus
first drop down menu populates second and second populates third
however, while doing this to and fro to DB it takes some time

Can someone please explain how can i change the curser while the
page loads. and again change to original state once data recvd.
I want to stop user clicking another links

Thanks.

Rahul Ashar






Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

That is not something JSP -- a server-side mechanism -- can help you with. I have moved this to a more appropriate forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Zaeed McColin
Ranch Hand

Joined: Jan 13, 2009
Posts: 90
alright
If your send and receiving data be in Ajax system you can do something
maybe we have many solution and standard methods but i say my solution
1:you want change cursor to "busy" through data processing and change it to normal after process
It's easy to solve
you can do it with CSS
try this

as you see if you want start to send and process call it with "true" and after process call it with "false" parameter


And........
about problem no 2.
you want to stop user clicking another links

OK i say my solution again
by default i think you can not say to browser disable links
but you can do another thing

alright
let's see how can we do it?
look in anchor tag we have a attribute "href" that on clicking tag browser change direction to it
so what do we do?
we remove each href value and store the value somewhere
maybe you can understand with a sample
look at this tag
<a href="google.com">King</a>
on clicking this tag browser go for google anyway
now we change <a href="google.com>king</a>" TO (something like)<a href="#" X="google.com"/>King</a>

as you saw we add a custom attribute to each anchor for store href value, because we want stop to change URL via clicking an anchor

look at this code
this function read all of the anchors, get the href values, store them in another attribute


as you see if you call it with true value, all anchorss goes for "#" and for false they come back with original values
BUT
We have a big problem here
so what is this?
OK check this two way
1: {
call changeA() with true
function get all hrefs values and store them to X and change values to "#"

call if with false
function set original hrefs
}
2: {
call changeA() with true
function get all hrefs values and store them to X and change values to "#"

(by a mistake or problem) call changeA() with true AGAIN
hrefs values changed to "#" with previous call, so Xs will changes to "#" and we missed original values
}

as you saw it's really big bug
we can sole it with a global variable or a if

so now we have optimized function

as you see we check the X attribute in each change
also you can change hrefs value to another value instead of "#" such as "javascript:alert('links disable through file processing')"

and a sample of all


also you can change onClick attribute of any tag if you want and necessar
I know that I teach like Chines language but hope you understood


Open source
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Changing the curser while the page is loading