46 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
	
	
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 | 
						|
<html>
 | 
						|
<head>
 | 
						|
  <title>Example 4.10</title>
 | 
						|
<script>
 | 
						|
function getClass()
 | 
						|
{
 | 
						|
 	document.write('<table width="40%" align = "center">');
 | 
						|
	var fname = " ";
 | 
						|
	var lname = " ";
 | 
						|
	var id = " ";
 | 
						|
	var username = 0;
 | 
						|
	var course = " ";
 | 
						|
	course = prompt("What is the name of this course?");
 | 
						|
	document.write('<tr><td colspan =4 align = "center">' + course + '</td></tr>');
 | 
						|
	document.write('<tr><td>first name</td><td>last name</td><td>ID number</td><td>username</td></tr>');
 | 
						|
	fname = prompt("Enter one student's first name:");
 | 
						|
	lname = prompt("Enter the student's last name:");
 | 
						|
	id = prompt("Enter the student's identification number:");
 | 
						|
	do
 | 
						|
	{
 | 
						|
		username = fname + id;
 | 
						|
		document.write('<tr><td>' + fname + '</td><td>' + lname + '</td><td>' + id + '</td><td>' + username + '</td></tr>');
 | 
						|
		fname = prompt("Enter another student's first name or enter 'X' when finished:");
 | 
						|
		lname = prompt("Enter another student's last name or enter 'X' when finished:");
 | 
						|
		id = prompt("Enter another student's identification number or enter -9 when finished:");
 | 
						|
	}
 | 
						|
	while  (id != -9)
 | 
						|
	document.write('</table>');
 | 
						|
}
 | 
						|
</script>
 | 
						|
</<head>
 | 
						|
<body>
 | 
						|
<table align ="center" width ="70%"><tr><td colspan ="2">
 | 
						|
<h1> </h2>
 | 
						|
<h1>Create Usernames</h1>
 | 
						|
<p>You can enter each student's name and ID number and <br />
 | 
						|
this program will create usernames for you</p>
 | 
						|
<tr><td><p> </p>
 | 
						|
<p><input type="button" id="username" value="Click to begin entering names" onclick="getClass();" /></p>
 | 
						|
</td></tr>
 | 
						|
</table>
 | 
						|
</body>
 | 
						|
</html>
 | 
						|
 |