Keep layout after page refresh or submit
Hi, I have this very simple code and if I focus on the textfield or button the backgrond color changes to red.
If I click submit, the page refreshes and the red background color is no more.
How can I keep this background color after a page refresh or submit?
The php in the head with the parse thing is just to load some jquery and css files your can replace it with '<script src="jquery-1.4.2.min.js" type="text/javascript"></script>' etc to test the code.
This is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<?php
require_once("business/koppelingen.php");
$k = new Koppelingen();
$koppelingen = $k->parse();
echo $koppelingen;
?>
<script type="text/javascript">
<!--
$(document).ready(function () {
$('input').focus(function () {
$(this).css('background-color','red');
});
$('#submit').submit(function () {
});
});
-->
</script>
</head>
<body>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="test" value="<?php echo htmlentities($test); ?>" />
<br /><br />
<input type="submit" name="submit" value="Submit" id="submit" />
</form>
</body>
</html>
Thanks