PDA

View Full Version : JS - Problem concerning 2 form fields and a JS


shevegen
03-19-2003, 05:15 PM
Hello all,

this is the first time I post here. Any help is appreciated, i dont think i would need detailed info, just a short guideline.


My problem:

I have two _different_ <form> fields, both contain several <input> data.

Now the user can input a string, which is then passed to an outside URL and processed. (It's a dictionary)
Right now it works fine - you input any word, it is passed outside to the target URL (opening a new window) and the data is processed by the perl/cgi script.Works perfect!


But I wanted to simplify it and the problem started ...
I want to open TWO new windows , and used target="_blank" so far.
Now I would like to have this:

1) Two windows get opened via a function-routine
2) This routine stores input data 1, and input data 2, and sends both of these things to the correct URLs



function TwoDict (arg)
{ ....
statements
... }

I frankly dont know how to open two URLs with data using Javascript...


---------------------
Here are the two forms i use at the moment:

FORM 1
<FORM NAME="dict" METHOD="GET" ACTION="http://dict.leo.org/" target="_blank">
<INPUT TYPE="submit" CLASS="Field1" VALUE="LEO SUCHE"> &nbsp;
<INPUT NAME="search" VALUE="" SIZE="22" MAXLENGTH="50"> </form>
FORM 2
<FORM NAME="dict" METHOD="GET" ACTION="http://dict.tu-chemnitz.de/" target="_blank">
<INPUT TYPE="submit" CLASS="Field1" VALUE="CHEMNITZ SUCHE"> &nbsp;
<INPUT NAME="search" VALUE="" SIZE="22" MAXLENGTH="50"> </form>

Danne
03-19-2003, 05:47 PM
There is a method
open(url,"_blank","")
you could use...

Ex;


function openNewWin(url)
{
open(url,"_blank","");
}

arnyinc
03-19-2003, 09:30 PM
<html>
<head>
<script language="javascript">
function TwoDict(){
document.dict1.submit();
document.dict2.submit();
}
</script>
</head>
<body>
<FORM NAME="dict1" METHOD="GET" ACTION="http://dict.leo.org/" target="_blank">
<INPUT TYPE="submit" CLASS="Field1" VALUE="LEO SUCHE">
<INPUT NAME="search" VALUE="" SIZE="22" MAXLENGTH="50"> </form>
FORM 2
<FORM NAME="dict2" METHOD="GET" ACTION="http://dict.tu-chemnitz.de/" target="_blank">
<INPUT TYPE="submit" CLASS="Field1" VALUE="CHEMNITZ SUCHE">
<INPUT NAME="search" VALUE="" SIZE="22" MAXLENGTH="50"> </form>

<input type="button" value="submit" onclick="TwoDict();">
</body>
</html>

shevegen
03-19-2003, 10:54 PM
wow thanks