Advertisement

06.30.2008 at 06:26PM PDT, ID: 23528876
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

Passing Back Value from Pop-Up

Asked by arthur_raft2 in PHP Scripting Language, JavaScript, Hypertext Markup Language (HTML)

Hello Experts,

Have a look at the attached scripts. The main page offers a select list of number values, with the option for users to Pop-Up a calculator page - both scripts are attached.

I need to "simple things"
(1) On the pop-up page, I need to pass a value from volume1 to volume2, Rounding-Up to the nearest 5,000.
(2) when the user closes the pop-up window, I need the rounded value to apear in the select list on the main page.

Tusting this is simple for you guys.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
MAIN PAGE:
 
<head>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>
 
<body>
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td nowrap="nowrap" class="style32"><span class="dropdown1">enter  volume :&nbsp;</span></td>
    <td nowrap="nowrap" class="style32"><span class="dropdown1">
      <select name="vol" class="dropdown2" id="vol" style="width:95px" onChange="updatePage()">
        <option value="20" <?=$vols[0]?> >20,000 litres</option>
        <option value="25" <?=$vols[1]?> >25,000 litres</option>
        <option value="30" <?=$vols[2]?> >30,000 litres</option>
        <option value="35" <?=$vols[3]?> >35,000 litres</option>
        <option value="40" <?=$vols[4]?> >40,000 litres</option>
        <option value="45" <?=$vols[5]?> >45,000 litres</option>
        <option value="50" <?=$vols[6]?> >50,000 litres</option>
        <option value="55" <?=$vols[7]?> >55,000 litres</option>
        <option value="60" <?=$vols[8]?> >60,000 litres</option>
        <option value="65" <?=$vols[9]?> >65,000 litres</option>
        <option value="70" <?=$vols[10]?> >70,000 litres</option>
        <option value="75" <?=$vols[11]?> >75,000 litres</option>
        <option value="80" <?=$vols[12]?> >80,000 litres</option>
        <option value="85" <?=$vols[13]?> >85,000 litres</option>
        <option value="90" <?=$vols[14]?> >90,000 litres</option>
      </select>
    </span></td>
    <td nowrap="nowrap" class="style32"><span class="dropdown1">- or - <img src="images/stories/icons/arrow_down.png" name="imgfirst" width="18" height="13" border="0" id="imgfirst" /> <a  href="javascript:;" onClick="MM_openBrWindow('vol_calc.html','','width=450,height=350')" >calculate here</a></span></td>
  </tr>
</table>
</body>
</html>
 
 
 
 
POP_UP PAGE:
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function KW_getVal(o){ //v1.2
	var retVal="0";if (o.type=="select-one")
	{retVal=(o.selectedIndex==-1)?0:o.options[o.selectedIndex].value;}
	else if (o.length>1){for (var i=0;i<o.length;i++) if (o[i].checked) retVal=o[i].value;
	} else if (o.type=="checkbox") {retVal=(o.checked)?o.value:0;} else {
	retVal=Number(o.value)}return parseFloat(retVal);
}
 
function KW_calcForm() { //v1.2
	var str="",a=KW_calcForm.arguments; for (var i=3;i<a.length;i++)
	str+=(a[i].indexOf("#")==-1)?a[i]:KW_getVal(MM_findObj(a[i].substring(1)));
	t=Math.round(a[1]*eval(str))/a[1];tS=t.toString();if(a[2]>0){tSp=tS.indexOf(".");
	if(tSp==-1)	tS+=".";tSp=tS.indexOf(".");while(tSp!=(tS.length-1-a[2])){tS+="0";
	tSp=tS.indexOf(".");}} MM_findObj(a[0]).value=tS;
}
//-->
</script>
 
<script>
 
function fnFormatField(id)
{
      r = roundNumber(parseInt(id.value),2);
      id.value = addCommas(r + '');
}
 
function addCommas(nStr)
{
      nStr += '';
      x = nStr.split('.');
      x1 = x[0];
      x2 = x.length > 1 ? '.' + x[1] : '';
      var rgx = /(\d+)(\d{3})/;
      while (rgx.test(x1)) {
            x1 = x1.replace(rgx, '$1' + ',' + '$2');
      }
      return x1 + x2;
}
 
function roundNumber(num, dec) {
      var result = Math.round(num/Math.pow(10,dec))*Math.pow(10,dec);
      return result;
}
 
function updatePage()
{
	document.getElementById("theForm").submit();
}
 
</script>
 
</head>
 
<body>
shape: 
<select name="shape" id="shape" onclick="KW_calcForm('volume1',100,2,'#length','*','#width','*','(','(','#deep','+','#shallow',')','/','2',')','*','1000','*','#shape');fnFormatField(volume1)">
  <option value="0.85">Curved / Irregular</option>
  <option value="1.0">Rectangular</option>
</select>
<br />
<br />
length: 
<select name="length" id="length" onclick="KW_calcForm('volume1',100,2,'#length','*','#width','*','(','(','#deep','+','#shallow',')','/','2',')','*','1000','*','#shape');fnFormatField(volume1)">
  <option value="5.0">5.0m</option>
  <option value="6.0">6.0m</option>
  <option value="7.0">7.0m</option>
  <option value="7.2">7.2m</option>
  <option value="7.4">7.4m</option>
  <option value="7.6">7.6m</option>
  <option value="7.8">7.8m</option>
  <option value="8.0">8.0m</option>
  <option value="8.2" selected="selected">8.2m</option>
  <option value="8.4">8.4m</option>
  <option value="8.6">8.6m</option>
  <option value="8.8">8.8m</option>
  <option value="9.0">9.0m</option>
  <option value="9.2">9.2m</option>
  <option value="9.4">9.4m</option>
  <option value="9.6">9.6m</option>
  <option value="9.8">9.8m</option>
  <option value="10.0">10.0m</option>
  <option value="10.2">10.2m</option>
  <option value="10.4">10.4m</option>
  <option value="10.6">10.6m</option>
  <option value="10.8">10.8m</option>
  <option value="11.0">11.0m</option>
  <option value="11.2">11.2m</option>
  <option value="11.4">11.4m</option>
  <option value="11.6">11.6m</option>
  <option value="11.8">11.8m</option>
  <option value="12.0">12.0m</option>
 
</select>
<br />
<br />
width: 
<select name="width" id="width" onclick="KW_calcForm('volume1',100,2,'#length','*','#width','*','(','(','#deep','+','#shallow',')','/','2',')','*','1000','*','#shape');fnFormatField(volume1)">
  <option value="3.0">3.0m</option>
  <option value="3.2">3.2m</option>
  <option value="3.4">3.4m</option>
  <option value="3.6">3.6m</option>
  <option value="3.8">3.8m</option>
  <option value="4.0">4.0m</option>
  <option value="4.2" selected="selected">4.2m</option>
  <option value="4.4">4.4m</option>
  <option value="4.6">4.6m</option>
  <option value="4.8">4.8m</option>
  <option value="5.0">5.0m</option>
  <option value="5.2">5.2m</option>
  <option value="5.4">5.4m</option>
  <option value="5.6">5.6m</option>
  <option value="5.8">5.8m</option>
  <option value="6.0">6.0m</option>
</select>
<br />
<br />
depth - shallow: 
<select name="shallow" id="shallow" onclick="KW_calcForm('volume1',100,2,'#length','*','#width','*','(','(','#deep','+','#shallow',')','/','2',')','*','1000','*','#shape');fnFormatField(volume1)">
  <option value="0.9">0.9m</option>
  <option value="1.0" selected="selected">1.0m</option>
  <option value="1.2">1.2m</option>
  <option value="1.3">1.3m</option>
  <option value="1.4">1.4m</option>
</select>
<br />
<br />
depth - deep
<select name="deep" id="deep" onclick="KW_calcForm('volume1',100,2,'#length','*','#width','*','(','(','#deep','+','#shallow',')','/','2',')','*','1000','*','#shape');fnFormatField(volume1)">
  <option value="1.0">1.0m</option>
  <option value="1.1">1.1m</option>
  <option value="1.2">1.2m</option>
  <option value="1.3">1.3m</option>
  <option value="1.4">1.4m</option>
  <option value="1.5">1.5m</option>
  <option value="1.6">1.6m</option>
  <option value="1.7">1.7m</option>
  <option value="1.8" selected="selected">1.8m</option>
  <option value="1.9">1.9m</option>
  <option value="2.0">2.0m</option>
</select>
<br />
<br />
calculated volume:
<input name="volume1" type="text" id="volume1" size="8" maxlength="8" />
<br />
<br />
volume rounded up: 
<input name="volume2" type="text" id="volume2" size="8" maxlength="8" />
</body>
</html>
[+][-]06.30.2008 at 08:52PM PDT, ID: 21904889

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, JavaScript, Hypertext Markup Language (HTML)
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.30.2008 at 09:40PM PDT, ID: 21905016

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 05:28AM PDT, ID: 21906969

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628