Jump to content

loading divs if statements?


dzhax

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...