• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in paging using javascript

 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my code:




Code is working properly, but can anyone tell me is there any other way to do this, here the function is being called so many of times.
how can i do this, without calling the hide function again and again???
 
Paul Clapham
Sheriff
Posts: 21154
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you had a "hideall" function then your code could look like this:
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:If you had a "hideall" function then your code could look like this:


Thanks paul, but how to make this "hideall" function where as "hide" function is not same always, it somewhere depends on the "show" function, can you tell me exactly...?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64994
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it hides all, and therefore is the same each time.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:No, it hides all, and therefore is the same each time.


But in my query/problem i don't want to hide same div's each time, if you noticed in the code the showPage function parameter/argument is changing everytime, i m calling that function, nd along that function i want to hide all other respective div's, for that i m calling hide() again nd again, because div id's are not same always/in every calling...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64994
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And if you notice in Paul's example, the correct div is shown after hiding all... Think!
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:And if you notice in Paul's example, the correct div is shown after hiding all... Think!



i write function like this:

function hideall()
{
for(int i=1;i<11;i++)
document.divs[i].visibility = "hidden";
}

but it's not working..
sorry if i m nt getting, i m new to js, can you tell me what should i write in hideall()..???
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Punit Jain wrote:
Bear Bibeault wrote:And if you notice in Paul's example, the correct div is shown after hiding all... Think!



okay i done it, code is like this:




and it's working now..
Any modifications will be appreciable....
Thank you all
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic