I have two versions of this document. The first version uses only JavaScript and the standard PROMPT(). It works very well, but I would like to insert the name prompt into the page using the input command. For some reason the variable loaded in the HTML statement doesn't get passed to the JavaScript. Any ideas would be appreciated! This is only a small test page. Sorry I don't know about the [code] tag...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="Sat, 10 Sep 2011 19:40:31 GMT">
<meta name="description" content="">
<meta name="keywords" content="">
<title>Enter golfers name</title>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="script1.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function GetPage(){
document.write("OK")
var lab = "";
var result = fullname.toUpperCase();
var word=result.split(" ");
fname = word[0]
lname = word[1]
alpha = lname.slice(0,1);
lab = fname.concat("_")
lab = lab.concat(lname)
if(word[2]){
ext = word[2]
lab = lab.concat("_")
lab = lab.concat(ext)
}
var intro = "./Stats_";
page = intro.concat(alpha);
page = page.concat("_golfers.html#");
page = page.concat(lab)
document.write(page)
<!-- window.location.pathname = page
}
</script>
</head>
<body>
<center>
<form action="form_action.asp" method="get">
You can enter the golfersname or select him from the above list.<br><br>
<input type="text" name="fullname" />
<button type="submit" onclick="GetPage()">GO</button>
</form>
</center>
<BR><BR><BR>
This is the end
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="Sat, 10 Sep 2011 19:40:31 GMT">
<meta name="description" content="">
<meta name="keywords" content="">
<title>Enter golfers name</title>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="script1.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function GetPage(){
document.write("OK")
var lab = "";
var result = fullname.toUpperCase();
var word=result.split(" ");
fname = word[0]
lname = word[1]
alpha = lname.slice(0,1);
lab = fname.concat("_")
lab = lab.concat(lname)
if(word[2]){
ext = word[2]
lab = lab.concat("_")
lab = lab.concat(ext)
}
var intro = "./Stats_";
page = intro.concat(alpha);
page = page.concat("_golfers.html#");
page = page.concat(lab)
document.write(page)
<!-- window.location.pathname = page
}
</script>
</head>
<body>
<center>
<form action="form_action.asp" method="get">
You can enter the golfersname or select him from the above list.<br><br>
<input type="text" name="fullname" />
<button type="submit" onclick="GetPage()">GO</button>
</form>
</center>
<BR><BR><BR>
This is the end
</body>
</html>
Comment