[Javascript] question on forms, windows, and locations

Brian Johnston brian at conbro.com
Tue Apr 24 16:41:58 CDT 2001


The short version:
I play Fantasy Baseball.
I use the Internet for a lot of Fantasy Baseball research.
I use the same sites to look at different players.
Each player has a unique ID number.

I want to create a page to allow me to input the ID number, and then hit a
button to generate a new a window with the link.

I am using Javascript to take the ID number from the input box and put in
the link.  This I have done successfully.

What I'd like to do now is have that link pop up in a new window.  However,
my limited knowledge in Javascript tells me that I have painted myself into
a corner with the way I've written the code.  I can get it to open the
correct link, but not in a new window.

Please take a look and tell me what I can do.
I'd like to use buttons instead of text links. Unfortunately, I haven't
figured out how to nail down the button part either.
(also available at: http://www.memphismojo.com/brian/baseball.html)

Thanks,

Brian

Now, the source:

<html>
<head>
<script language="javascript">
<!--


function makeFLB(){
var my_player_number = document.FLB.player_number.value;
var FLB = 
"http://games.espn.go.com/cgi/flb/request.dll?PLAYERCARD&nPlayerID=" +
my_player_number;

window.location.href=(FLB);

}
function makePRO(){
var my_player_number = document.FLB.player_number.value;
var PRO = "http://espn.go.com/mlb/profiles/profile/" + my_player_number +
".html";


window.location.href=(PRO);
}

//-->
</script>
</head>

<body>

<form name="FLB">
<input type="text" name="player_number">
<P>
<a href="javascript:makeFLB()";>FLB Profile</a>
<P></form>


<form name="PRO">
<a href="javascript:makePRO()";><input name="player_number" type="button"
value="ESPN Profile"></A>
</form>


</body>
</HTML>






More information about the Javascript mailing list