View Single Post
  #1 (permalink)  
Old 08-06-06, 06:42 AM
Hunter Hunter is offline
Newbie Coder
 
Join Date: Dec 2005
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Paypal Generator

Hey, I have a script that is for generating the link to paypal depending on what game server they want to buy... It generates the price, then goes to paypal.
But I want to change the submit button to load up in a new window.
Code:
<script language="javascript">
function addMeUp() {
	ps=eval(form.ps.value)
	vs=eval(form.vs.value)
	db=eval(form.db.value)
	mode=eval(form.mode.value)
	game=form.game.value;
	voiceselect=form.voiceselect.value;
	paymethod=eval(form.method.value)
	nummonths=eval(form.months.value)
	
	if (game == 'AA') { var gcost = '1.00'; }
	else if (game == 'none') { var gcost = '0.00'; }
	else if (game == 'BF2') { var gcost = '1.00'; }
	else if (game == 'BFV') { var gcost = '1.00'; }
	else if (game == 'BF1942') { var gcost = '1.00'; }
	else if (game == 'WET') { var gcost = '1.00'; }
	else if (game == 'ET') { var gcost = '1.00'; }
	else if (game == 'UT03') { var gcost = '1.00'; }
	else if (game == 'UT04') { var gcost = '1.00'; }
	else if (game == 'UT07') { var gcost = '1.00'; }
	else if (game == 'UT') { var gcost = '1.00'; }
	else if (game == 'SOF2') { var gcost = '1.00'; }
	else if (game == 'MOH') { var gcost = '1.00'; }
	else if (game == 'MOHAA') { var gcost = '1.00'; }
	else if (game == 'MOHPA') { var gcost = '1.00'; }
	else if (game == 'MOHB') { var gcost = '1.00'; }
	else if (game == 'MTAVC') { var gcost = '1.00'; }
	else if (game == 'COD2') { var gcost = '1.00'; }
	else if (game == 'CODUO') { var gcost = '1.00'; }
	else if (game == 'COD') { var gcost = '1.00'; }
	else if (game == 'HL1DM') { var gcost = '1.00'; }
	else if (game == 'HL1RICOCHET') { var gcost = '1.00'; }
	else if (game == 'HL1TFC') { var gcost = '1.00'; }
	else if (game == 'HL1DMC') { var gcost = '1.00'; }
	else if (game == 'HL1OF') { var gcost = '1.00'; }
	else if (game == 'HL2DM') { var gcost = '1.00'; }
	else if (game == 'HLTFC') { var gcost = '1.10'; }
	else if (game == 'HL2DM') { var gcost = '1.10'; }
	else if (game == 'CS1.6') { var gcost = '1.00'; }
	else if (game == 'CSCZ') { var gcost = '1.00'; }
	else if (game == 'CSS') { var gcost = '1.00'; }
	else if (game == 'CSS66TICK') { var gcost = '1.00'; }
	else if (game == 'CSS100TICK') { var gcost = '1.00'; }
	else if (game == 'DOD') { var gcost = '1.00'; }
	else if (game == 'DODS') { var gcost = '1.00'; }
	else if (game == 'Farcry') { var gcost = '1.00'; }
	else if (game == 'FEAR') { var gcost = '1.00'; }
	else if (game == 'HALOCE') { var gcost = '1.00'; }
	else if (game == 'LFSs2') { var gcost = '1.00'; }
	else if (game == 'Q2') { var gcost = '1.00'; }
	else if (game == 'Q3ARENA') { var gcost = '1.00'; }
	else if (game == 'Q4') { var gcost = '1.00'; }
	else if (game == 'RS3RS') { var gcost = '1.00'; }
	else if (game == 'RTCW') { var gcost = '1.00'; }
	else if (game == 'SWAT4') { var gcost = '1.00'; }
	
	pgcost=ps*gcost
	
	if (voiceselect == 'none') { var vcost = '0.00' }
	else if (voiceselect == 'ts2') { var vcost = '0.00' }
	
	pvcost=vs*vcost
	
	if (mode == '3') { state = 'Public';	}
	else if (mode == '0') { state = 'Private'; }	

	if (db == '3') { debranding = 'DB';	}
	else if (db == '0') { debranding = 'B'; }	

	monthtotal=pgcost+pvcost+db+mode
	monthtotal= (nummonths == 1) ? (monthtotal*100)/100 : monthtotal
	monthtotal= (nummonths == 3) ? (monthtotal*100)/100 : monthtotal
	monthtotal= (nummonths == 6) ? (monthtotal*100)/100 : monthtotal
	monthtotal= (nummonths == 12) ? (monthtotal*100)/100 : monthtotal
		
	subtotal=monthtotal*nummonths
	totalcost=subtotal
	
	form.monthly.value="\u00A3 "+monthtotal.toFixed(2)
	form.mycost.value=totalcost.toFixed(2)
	form.total.value="\u00A3 "+totalcost.toFixed(2)
} 

function gotoLink() {
	if (form.terms.value == 'Refuse') {
		alert ('You Have To Accept To Our Terms & Conditions To Continue');
	} else {
		months=eval(form.months.value);
		cost=eval(form.mycost.value);
		ps=eval(form.ps.value);
		vs=eval(form.vs.value);
		db=eval(form.db.value);
		mode=eval(form.mode.value);
		linkid=eval(form.method.value);
		game=form.game.value;
		voiceselect=form.voiceselect.value;
		pfname=form.pfname.value;
		pfemail=form.pfemail.value;
		rconpw=form.rconpw.value;

		alert ('Thank You For Shopping With XGServers.co.uk');
		if (linkid==2)  link="https://www.paypal.com/subscriptions/business=xgservers@hotmail.co.uk&item_name=Pub/Priv:+"+state+"+|+Game Slots:"+ps+"+|+Game:"+game+"+|+Voice Slots:"+vs+"+|+Voice Comms:"+voiceselect+"+|+De/Branded:"+debranding+"+|+Length:"+months+"+Month(s)+|+Name:+"+pfname+"+|+E-mail:+"+pfemail+"+|+Rcon:"+rconpw+"+end&no_note=1&currency_code=GBP&a3="+cost+"&p3="+months+"&t3=M&src=1&sra=1"
		
		window.location.href=link
	}
}
            </script>
Heres all the java that generates the price, then makes the link.
Code:
<input name="button" type="button" target="_blank" onClick="gotoLink()" value="Order Now" style="border:1px solid #FFFFFF; width:160; font-size:8pt; font-family:Tahoma; color:#FFFFFF; background-color:#000000">
Here is my submit button.

Do I need to change this? - window.location.href=link

Regards,
Hunter
Reply With Quote