javascript - Is there a way to make things visible and invisible in HTML as per requirements? -


we made j2ee project in our class required 58 different webpages. lot of them redundant in opinion. how? let me give simple example. after "login" page, both admin , common user logs in, 1 redirected common page, there several buttons. buttons common user , admin, admin can see buttons in same page. did- made first common part of page , made page copy-pasting code common page , added buttons admins privileges. after confirming user, redirected him common page, again if user confirmed admin, redirected him buttons added page.

i feel approach redundant. should have made single page admin view , should have made arrangements if user confirmed admin, can see everything, if confirmed user, buttons hide automatically. htere way in html pages? along html, used little css , javascript (alert etc.)

for common pieces of html, can:

  1. use templates
  2. use hidden sections of html make visible upon demand
  3. use dynamically loaded html (loaded upon demand common source via javascript)
  4. use popup html windows (not recommended)
  5. use server-side includes include common section in many pages

there many different choices don't involve copying same html across many different pages , select depends upon particular circumstances and, in cases, tools using , capabilities make simple.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -