Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: Intermediate
Feb 11, 1999

Hide Unnecessary Navigation Buttons Using DHTML

Hide your navigation buttons using DHTML when you don't need them. Imagine a page with a databound table on it showing ten rows of data. When you're at the beginning or end of the table, either the "Previous" or the "Next" button is not needed. The following code shows how to play "peek-a-boo" with the buttons. When you're at the start of the table the "Previous" button is hidden while the "Next" button is displayed and at the end of the table the "Next" button is hidden while the "Previous" button is displayed.
Sub SetNavigationDisplay()
	'Set display for Previous Button
	If miPageNumber = 1 Then
		cmdPrevious.style.display = "none"
		cmdPrevious.style.display = ""
	End If

	'Set display for Next Button
	If miPageNumber = MaxPage Then
		cmdNext.style.display = "none"
		cmdNext.style.display = ""
	End If
End Sub
Mike Gasperino
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.