Forum Moderators: open

Message Too Old, No Replies

window load to blank page

         

etu1972

10:07 pm on Apr 4, 2005 (gmt 0)

10+ Year Member



Hi, I'm using this format to change product quanity in a button going to a shopping cart:

<FORM name="quantityform1" target="_blank">
<SELECT name="productquantity">
<OPTION SELECTED value="http://www.mysite.com/Merchant2/merchant.mvc?Screen=BASK&Store_Code=ABC&Action=ADPR&Product_Code=4-21402&Attributes=Yes&Quantity=1" target="blank"> 1
<OPTION value="http://www.mysite.com/Merchant2/merchant.mvc?Screen=BASK&Store_Code=ABC&Action=ADPR&Product_Code=4-21402&Attributes=Yes&Quantity=2">2
</SELECT>
&nbsp;&nbsp;

<INPUT type="button" name="go" value="Add To Cart" STYLE="font-family:Times New Roman, Times, serif; font-size:14;
font-weight: bold; background:#f2f2f2; color:#ff0000; width:80; border:none" onClick="window.location=document.quantityform.productquantity.options[document.quantityform.productquantity.selectedIndex].value">
</FORM>

I can't make it go to a blank window using target="_blank" in the form tag, in the html name or in the button input field. I'm not great at javascript obviously. Can anyone tell me how to change the onClick to make it go to a blank window? Much Thanks, AMc

SpaceFrog

7:41 am on Apr 5, 2005 (gmt 0)

10+ Year Member



well you are using window.location...
so you shouldn't expect your browser to open new window

you should use a window.open syntax

etu1972

8:31 am on Apr 5, 2005 (gmt 0)

10+ Year Member



Hi and thanks.

I tried changing window.location to window.open and since it didn't work, I guess the window.open needs different parameters. My objective is to allow a site visitor to choose 1 or 2, click the button, and be taken to a new window containing the url page associated with either 1 or 2, based on what they chose.

I found the basis for this window.location code online and it neatly does the trick, except that as you say, I must need window.open to get the new window. I just don't know how to rewrite the onclick to make it work.

Thanks,

SpaceFrog

8:55 am on Apr 5, 2005 (gmt 0)

10+ Year Member



onClick="window.open=(document.quantityform.productquantity.options[document.quantityform.productquantity.selectedIndex].value)">

etu1972

9:08 am on Apr 5, 2005 (gmt 0)

10+ Year Member



Hoolawl, that did it! My guess was it was something basic, but this basic mind couldn't wrap itself around it. THANKS! AMc

SpaceFrog

9:39 am on Apr 5, 2005 (gmt 0)

10+ Year Member



then you can add size and position parameters at your desire ... ;-)