can not send form parameters to a javascript function window.open()

[nobr]<form id="form1" name="form1" method="post" action="">

<td width="30"><input type="radio" name="icon" value="1"/></td>

<td width="53"><img src="<%=SiteManager.getRootURL()%>/resimler/icon1.gif" alt="" width="35" height="30" /></td>

<td width="41"> <input type="radio" name="icon" value="2" checked="checked"/></td>

<td width="51"><img src="<%=SiteManager.getRootURL()%>/resimler/icon2.gif" alt="" width="26" height="31" /></td>

<td width="38"><input type="radio" name="icon" value="3" /></td>

<td width="96"><img src="<%=SiteManager.getRootURL()%>/resimler/icon3.gif" alt="" width="30" height="32" /></td>

</tr>

<tr>

<td><br><input type="radio" name="bgColor" id="arkaradio1" value="1"/></td>

<td> <div style="position: absolute; width: 30px; height: 18px; background-color: #F0F0FF;" id="d1"></div></td>

<td><br> <input type="radio" name="bgColor" id="arkaradio2" value="2" checked="checked" /></td>

<td><div style="position: absolute; width: 30px; height: 18px; background-color: #FFFF9F; " id="d2"></div> </td>

<td><br><input type="radio" name="bgColor" id="arkaradio3" value="3" /></td>

</tr>

<table width="392" border="0">

<tr>

<td width="98" height="50">

<div class="style4" id="d31" style="position: absolute; width: 75px; height: 18px; background-color: #FFFF9F;"> URL :</div>

<td width="284">

<input name="url" type="text" id="Url" size="36" /></td>

</tr>

</table>

<tr>

<td width="159"><input type="button" name="Tamam" value="Tamam" onclick="open_upload(icon,bgColor,url)" ></td>

</tr>

</table>

</form>

I have a form after clicking okey button I want to open a new window but I need parameters of form. I have ajavascript function:

<script type="text/javascript" language="JavaScript">

function open_upload(icon,bgColor,url){

window.open("http://localhost:8080/iyikidogdun/dogumgunu/widget/islemDogumgunuYayinla.jsp?username=" + username +"&bgcolor=" + bgColor +"&icon=" + icon +"&url="all,

"_self");

}

</script>

it doesnt work.Please help me...[/nobr]

[4280 byte] By [Dhuygua] at [2007-11-27 10:35:01]
# 1

This is really the wrong forum for javascript/html questions ...

Try

window.open("http://localhost:8080/iyikidogdun/dogumgunu/widget/islemDogumgunuYayinla.jsp?username=" + document.form1.username.value + "&bgcolor=" + document.form1.bgColor.value + "&ic

...ect ect

To preview the text to see where the wrong data is occuring, replace window.open with window.alert just for debugging purposes until the string is as you want it.

By the way, i can't see where the data for username comes from in the form example you gave.

Bamkin

bamkin-ov-lestaa at 2007-7-28 18:32:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

A better approach is to set the target of the form to say "open in a new window"

<form id="form1" name="form1" method="post" action="/iyikidogdun/dogumgunu/widget/islemDogumgunuYayinla.jsp" target="_blank">

That will tell it to submit the form to that JSP page, and open it in a window specifed by target.

A target of "_blank" will always open a new window

Cheers,

evnafets

evnafetsa at 2007-7-28 18:32:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...