The moose likes HTML, CSS and JavaScript and the fly likes dynamic HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "dynamic HTML" Watch "dynamic HTML" New topic
Author

dynamic HTML

frank braunstein
Ranch Hand

Joined: Dec 17, 2009
Posts: 60
hey there folks,

a little question: I want my html form to be dynamic. For instance, the user chooses an entry from a dropdown box and according to what he chooses the rest of the site laying under the dropdown box changes immediatley. I can remember having seen that on the internet and its quite common. How can i achieve such site behaviour?

thanks for replies...
Chinna Eranna
Ranch Hand

Joined: Dec 08, 2009
Posts: 174

Use frames..

http://www.w3schools.com/html/html_frames.asp


- Chinna
frank braunstein
Ranch Hand

Joined: Dec 17, 2009
Posts: 60
Chinna Eranna wrote:Use frames..

http://www.w3schools.com/html/html_frames.asp

I dont like frames! Isn't there another option? Something i could do with JSP's ?
Chinna Eranna
Ranch Hand

Joined: Dec 08, 2009
Posts: 174

frank braunstein wrote:
I dont like frames! Isn't there another option? Something i could do with JSP's ?


Any particular reason ?

You can also do it through JSP.

Say.. you have two values in select Box (1, 2) and two layouts to be displayed.. layout1 and layout2.

In the main jsp, you can have select box with these two values.. and include layout1.jsp and layout2.jsp depending on the value of the select box..

Whenever user changes the value in select box.. refresh the whole page.

frank braunstein
Ranch Hand

Joined: Dec 17, 2009
Posts: 60
Chinna Eranna wrote:
frank braunstein wrote:
I dont like frames! Isn't there another option? Something i could do with JSP's ?


Any particular reason ?

You can also do it through JSP.

Say.. you have two values in select Box (1, 2) and two layouts to be displayed.. layout1 and layout2.

In the main jsp, you can have select box with these two values.. and include layout1.jsp and layout2.jsp depending on the value of the select box..

Whenever user changes the value in select box.. refresh the whole page.



I was thinking too complicated. thank you very much...
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
Frames? Are we back in the 90's, nope just checked my calendar.

You need to have an onchange event to look at the form field value or text



You can just show and hide the fields on the page. It is as simple as



Eric
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

Chinna Eranna wrote:Use frames

Frames? 1999 called and wants their site back!

Chinna Eranna wrote:Whenever user changes the value in select box.. refresh the whole page.

Another antiquated approach from days when browsers were much less capable.

In modern browsers, showing and hiding elements dynamically is easy. Even creating new elements on the fly has become commonplace with the help of JavaScript libraries.

There is no need to resort to out-dated methods like frames and full-page refreshes.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
IntelliJ Java IDE
 
subject: dynamic HTML
 
Threads others viewed
Select value
Dynamic dropdownbox
dynamic list box issue
drop down box using struts
dynamic dropdown
MyEclipse, The Clear Choice