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:
- use templates
- use hidden sections of html make visible upon demand
- use dynamically loaded html (loaded upon demand common source via javascript)
- use popup html windows (not recommended)
- 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
Post a Comment