Jump to content

Check out our Community Blogs


Member Since 21 Nov 2008
Offline Last Active Nov 27 2008 02:49 AM

Topics I've Started

Help with a part of code - working with strings

26 November 2008 - 04:28 AM

Hi all,

I trying to get the following code working... no success yet, so I suspect a formal error in the code somewhere.


var czUspresence as int 
var czUscontrol as int 
var czUssrpresence as int 
var czUssrcontrol as int 

function euGetstatus(){ 
   var czUs = document.getElementById("cze_us").value; 
   var czUssr = document.getElementById("cze_ussr").value; 
   var sumCz = parseInt(czUs,10) - parseInt(czUssr,10) 
   if (sumCz < -2) 
   {czUssrcontrol = 1 ; 
   czUscontrol = 0; 
   czUssrpresence = 1; 
      if (czUs > 0) 
      {czUspresence = 1; 
   else if (sumCz > 2) 
   {czUscontrol = 1; 
   czUssrcontrol = 0; 
   czUspresence = 1; 
      if (czUssr > 0) 
      {czUssrpresence = 1; 
   else if (sumCz <> 0) 
      {if (czUs>czUssr) 
      {czUspresence = 1; 
      czUssrpresence = 1; 
   document.getElementById("euUsregular").value = sumUspresence; 
   document.getElementById("euUsbattleground").value = czUscontrol; 
   document.getElementById("euUssrregular").value = czUssrpresence; 
   document.getElementById("euUssrbattleground").value = czUssrcontrol; 



<select style="position:absolute; left:919px; top:286px; background-color: blue; color: white;" id="cze_us" class="us" onchange="euGetstatus();"> 
<option selected>0 <option>1 <option>2 <option>3 <option>4 <option>5 <option>6 <option>7 <option>8 <option>9 <option>10 <option>11 

<select style="position:absolute; left:956px; top:286px; background-color: red; color: white;" id="cze_ussr" class="ussr" onchange="euGetstatus();"> 
<option selected>0 <option>1 <option>2 <option>3 <option>4 <option>5 <option>6 <option>7 <option>8 <option>9 <option>10 <option>11 

<input type="text" id="euUsregular" style="position:absolute; left:550px; top:150px;  background-color: cyan; color: black" readonly=true size="2" value="" align="center"/> 
<input type="text" id="euUsbattleground" style="position:absolute; left:550px; top:180px;  background-color: cyan; color: black" readonly=true size="2" value="" align="center"/> 
<input type="text" id="euUssrregular" style="position:absolute; left:600px; top:150px;  background-color: pink; color: black" readonly=true size="2" value="" align="center"/> 
<input type="text" id="euUssrbattleground" style="position:absolute; left:600px; top:180px;  background-color: pink; color: black" readonly=true size="2" value="" align="center"/> 


Can someone help with finding the error and/or correcting any mistake in there?

What I am trying to do is to check the two values (cze_us and cze_ussr) to see, which one is bigger and also their difference. One of the breaking points is (-)3, where the respective country would get cz****control and also cz****presence equal to 1.

When the difference is less then 3 and a country has more than 0 (cze_us or cze_ussr), that country gets only cz****presence equal to 1.

If a country has its cze_us(sr) value equal to 0, it does not get any cz****presence or control.

Hope I am clear ;)

Two questions regarding <select> data manipulation

21 November 2008 - 02:19 AM

Hi all programmers,

I am creating a simple webpage with an image in the background and multiple comboboxes (<select> tag) for the user to select values. Here is one of the comboboxes:

<select style="position:absolute; left:919px; top:288px; background-color: blue; color: white;" id="cze us" class="us">
<option selected>0 <option>1 <option>2 <option>3 <option>4 <option>5 <option>6 <option>7 <option>8 <option>9 <option>10 <option>11

I need to work with these selected values further and as I am quite a noob in HTML/Web programming, I have these questions:

1. How could I add values in multiple comboboxes selected, e.g. 1,3,2,6,0 together to a sum value with a button click?

2. Or would it be possible to make the addition interactive - e.g. once the user selects a different value in a combobox, the sum would be adjusted?

3. How could I store the current selections in multiple comboboxes in a txt file on the server and then recall it later?



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download