Server/Code/newsinger.html

From kJams Wiki
Jump to navigation Jump to search
<html>
	<head>
		<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
		<title>kJams New Singer</title>
		
		<script src="common.js"></script>
		<script src="./spry/xpath.js"></script>
		<script src="./spry/SpryData.js"></script>
		<script src="data.js"></script>
		<script type="text/javascript">
			function catname(){
				var firstname = document.forms[0].singerfirstname.value;
				var lastname = document.forms[0].singerlastname.value;
				document.forms[0].singername.value = firstname + " " + lastname;
			}
			function validate(thisform) {
				with (thisform){
					if (singerfirstname.value=='') {
						alert('Hey, unless you\’re Obama, ya gotta give me a first name too. Try again.');
						event.returnValue=false;
					}
					else if (singerlastname.value=='Required!') {
						alert('What, you think you\’re Madonna? A last name is required. Lets try this again..');
						event.returnValue=false;
					}
						//safe to navigate away from this page
				}
			}
						    //variable to control if message is shown
    var allowUnload = false;
  
    //function triggered by any closing of the current document
    function confirmUnload(){ 
        if(!allowUnload){
            //message displayed (as well as inbuilt IE junk) when page is unloaded.
            return 'Why on earth would you think it is a good idea to close this window?!? Well, it ISN\'T!!! Do NOT close this window. If you do, all hell will rain down upon you, you will get A.I.D.S., and I will get very upset. (At you closing the window, not the A.I.D.S..)\n:\'(';
        }
    }

    //register function with the event handler
    window.onbeforeunload = confirmUnload;
		</script>
		
		<style type="text/css">
			#main {
				width: 400px;
				margin-left: auto;
				margin-right: auto;
				text-align: center;
				background: url('metal.jpg');
				border-style: solid;
				border-color: #000000;
				border-width: 1px;
			}
			
			#main p {
				font-size: 24pt;
			}
			
			#main table {
				margin-left: auto;
				margin-right: auto;
			}
			
			#main img {
				margin-bottom: 10px;
			}
		</style>
	</head>
	
	<body>
		<div id="main">
			<p>New Singer</p>
			<img src="kjams.png" /><br />
			<font color="#FF0000"></font>
			<form id="form" method="POST" action="" onsubmit="validate(this); allowUnload=true">
				<table>
					<input type="hidden" id="singername" name="singername">
					<tr><td>First Name: </td><td><input type="text" name="singerfirstname" value="" onkeyup="catname()"/></td></tr>
					<tr><td>Last Name: </td><td><input type="text" name="singerlastname" value="Required!" onfocus="this.value= (this.value=='Required!') ? '' : this.value" onBlur="this.value= (this.value=='') ? 'Required!' : this.value" onkeyup="catname()"/></td></tr>
					<tr><td>Password: </td><td><input type="password" name="password" id="password" /></td></tr>
<script type="text/javascript">
var p = document.getElementById('password');
p.type = 'text';
p.value = 'Make a password';
p.onfocus = function() {
if (this.type == 'text') {
this.value = '';
this.type = 'password';
this.focus();
}
}
</script>
					<tr><td>Again: </td><td><input type="password" name="confirm" value="" /></td></tr>
					<tr><th colspan="2"><input type="submit"  name="submit" value="Jam Out!" /></th></tr>
				</table>
			</form>
			<p style="font-size: 12pt;">[ <a href="/" onClick="allowUnload=true">Back</a> ]</p>
		</div>
		
		<script language="javascript">
			document.getElementById("form").action = url_newsinger;
		</script>
	</body>
</html>