...

View Full Version : popup window problem



reasr
03-19-2005, 12:59 PM
hi,

i have a script with some checkboxes and textbox , the function of the script is to get some calculations , this script is in the following page: http://www.geocities.com/breemo22/Prices.html

my problem is : the total is not showing in the popup

here is the popup code "pop.html" :

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
onload=function()
{
var root=document.getElementById('content');
for(var j=0;j<opener.items.length;j++)
{
var oTxt=document.createTextNode(opener.items[j]);
var oBr=document.createElement('br');
root.appendChild(oTxt);root.appendChild(oBr);
}
}
</script>
</head>
<body>
<div id="content"></div><br>
<br>
<br><br>
<input name="" type="button" value="Print" onclick="self.print()"><input name="" type="button" value="Close" onclick="self.close()">
</body>
</html>


please help


Regards

reasr

vwphillips
03-19-2005, 01:42 PM
I'm having a look at this but seems a difficukt way of meeting objective

see

http://www.vicsjavascripts.org.uk/PopUpGenerator/PopUpGenerator.htm

the Any HTML bit

back later

vwphillips
03-19-2005, 03:39 PM
not sure what I have done but this works




<HTML>
<HEAD><TITLE>Prices</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<SCRIPT>
var items = new Array()
function popS(f){
var sa=f.Accessories.selectedIndex;
var i=0;
if(f.shoes.checked){ items[i]=f.shoes.value;i++}
if(f.tshirt.checked){items[i]=f.tshirt.value;i++}
if(f.watch.checked){items[i]=f.watch.value;i++}
if(sa>0){
items[i]=f.Accessories.options[sa].text;
i++
}
alert(items)
var popU = window.open('pop.html','newwin','height=400 width=400')
}
</SCRIPT>

<SCRIPT>
function count()
{
if (calc.tshirt.checked){ var wtshirt = document.calc.tshirt.value = 1600;}
else{ var wtshirt = document.calc.tshirt.value = 0;}

if (calc.watch.checked){ var wwatch = document.calc.watch.value = 370;}
else{ var wwatch = document.calc.watch.value = 0;}

if (calc.shoes.checked){ var wshoes = document.calc.shoes.value = 6590;}
else{ var wshoes = document.calc.shoes.value = 0;}

document.calc.pay.value = wshoes + wtshirt + wwatch + parseFloat(document.getElementById("total").value);

}





</SCRIPT>

<META content="MSHTML 5.00.3700.6699" name=GENERATOR></HEAD>

<BODY bgColor=#008080>


<P align=center>prices</P>
<FORM name=calc>
<INPUT name=shoes type=checkbox value=Shoes >Shoes<BR>
<INPUT name=tshirt type=checkbox value=T-shirt >T-shirt<BR>
<INPUT name=watch type=checkbox value=Watch >Watch<BR>Accessories :<BR>
<SELECT id=Accessories name=Accessories onchange=update_total()>
<OPTION dir=rtl selected value=0>Accessores --------------------</OPTION>
<OPTION dir=rtl value=600>Pen</OPTION>
<OPTION dir=rtl value=370>Mobile</OPTION>
<OPTION dir=rtl value=0>None</OPTION>
</SELECT>
<BR>
<BR>Price of Accessory:<BR>
<INPUT id=total name=total> <BR>
<BR>
&nbsp;<INPUT id=pay name=pay>
<INPUT onclick=count() type=button value="Total Price">
<INPUT onclick=popS(this.form) type=button value=Report>
</FORM>

<SCRIPT>
function update_total()
{
document.getElementById("total").value=parseFloat(document.getElementById("Accessories").value);
}
update_total();
</SCRIPT>
</BODY>
</HTML>







<html>
<head>
<script language="JavaScript" type="text/JavaScript">
onload=function(){
var root=document.getElementById('content');
for(var j=0;j<opener.items.length;j++){
var oTxt=document.createTextNode(opener.items[j]);
var oBr=document.createElement('br');
root.appendChild(oTxt);
root.appendChild(oBr);
}
}
</script>
</head>
<body>
<div id="content"></div><br>
<br>
<br><br>
<input name="" type="button" value="Print" onclick="self.print()"><input name="" type="button" value="Close" onclick="self.close()">
</body>
</html>

reasr
03-20-2005, 05:47 AM
but still the total not shows on the popup!!

vwphillips
03-20-2005, 02:28 PM
<SCRIPT>
var items = new Array()
function popS(f){
count();
var sa=f.Accessories.selectedIndex;
var i=0;
if(f.shoes.checked){ items[i]=f.shoes.value;i++}
if(f.tshirt.checked){items[i]=f.tshirt.value;i++}
if(f.watch.checked){items[i]=f.watch.value;i++}
if(sa>0){
items[i]=f.Accessories.options[sa].text;
i++
}
items[i]=f.pay.value
alert(items)
var popU = window.open('pop.html','newwin','height=400 width=400')
}
</SCRIPT>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum