Jump to content

loading divs if statements?


dzhax
 Share

Recommended Posts

Im working on an intranet site for work and i am limited to html, css, and js.I would like to be able to do somthing similar to this:

<html>  <head>	<title>Untitled</title>  </head>  <body>	<div>	  Blah... blah...	  <? if(action=='login'){ ?>		<div>		  User: <input type="text" /><br/>		  Pass: <input type="password" />		</div>	  <? } else { ?>		<div>		  Logged In stuff....		</div>	  <? } ?>	</div>  </body></html>

but with only js?I want to make custom pages according to nt login and I already have the code to throw the nt user into a js variable.

Edited by dzhax
Link to comment
Share on other sites

You could embed a script where the divs need to be written. The script could use some if-else structure and document.write to generate the HTML. I normally hate document.write, but this is the kind of thing it was designed for.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...