mardi 17 février 2015

how to document.getElementById().innerHTML from different html/php file


Hello I am really new to coding in general but I got the basics of what I need.


I have my index.html that contains this:



<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="hidden">
<a href="#page-top"></a>
</li>
<li class="page-scroll">
<a href="#portfolio">Portfolio</a>
</li>
<li id="navbutone" class="page-scroll">
<a href="login.php">Login</a>
</li>
<li id="navbuttwo" class="page-scroll">
<a href="register.php">Register</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>


keep in mind I got this from a website template that I am editing so I didn't come up with this layout


and I have a php file that has some html in it to try and replace the contents of the list when this part of the code is run:



<?php
if($login_ok)
{
?>
<script type="text/javascript">
function logedin() {
document.getElementById("one").innerHTML = "<a href="logout.php">Logout</a>";
}
</script>
<script type="text/javascript">
logedin();
</script>
<?php
header("Location: index.html");
die("Redirecting to: private.php");
}
?>


This doesn't work and I have no idea if this is even close or not. Thanks in advance for the help. also I might add that they link to login.php where they login through an html form at the bottom of the php.



?>
<h1>Login</h1>
<form action="login.php" method="post">
Username:<br />
<input type="text" name="username" value="<?php echo $submitted_username; ?>" />
<br /><br />
Password:<br />
<input type="password" name="password" value="" />
<br /><br />
<input type="submit" value="Login" />
</form>
<a href="register.php">Register</a>

<script src="index.html"></script>

</html>




Aucun commentaire:

Enregistrer un commentaire