473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem with a form!

Good mornin' colleagues!

I have a problem with a javascript code. I attempt to program a mini
application with javascript. This application is part of a frameset.

I select three fields in this page and need that with this information
the javascript code compose an "URL" to put the desired page into the
frame named "mainframe".

My common errors are that this program don't put the desired page.

I need correct my code but I don't know very much of this language...
Can you help me?

##### The code as follows

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Estudio de Puntos de Venta y Centros de Consumo</title>
<meta CONTENT="text/html; charset=utf-8" HTTP-EQUIV="Content-Type"/>
<meta content="Resumen del &quot;Estudio de Puntos de Venta y Centros
de Consumo&quot;" name="description"/>
<meta content="" name="keywords"/>
<meta content="" name="author"/>
<meta content="lv******@velmark.com.mx" name="email"/>
<meta content="Velmark, S. A. de C. V., 2005" name="copyright"/>
<link type="text/css" rel="stylesheet" href="style.css"/>
<style type="text/css">
<!--
body {
background-color: #006699;
}
-->
</style>
<script language="javascript">
function proceso() {

a = document.formulario;

var documento = '';
var carpeta = 'content';
var camino = '';

if (a.plaza.value=0 && a.tipo.value=0)
documento = "monterrey_cluster.htm";
else
if (a.plaza.value=0 && a.tipo.value=1)
documento = "monterrey_cond.htm";
else
if (a.plaza.value=1 && a.tipo.value=0)
documento = "v_mexico_cluster.htm";
else
if (a.plaza.value=1 && a.tipo.value=1)
documento = "v_mexico_cond.htm";
else
if (a.plaza.value=2 && a.tipo.value=0)
documento = "leon_cluster.htm";
else
if (a.plaza.value=2 && a.tipo.value=1)
documento = "leon_cond.htm";
else
if (a.plaza.value=3 && a.tipo.value=0)
documento = "merida_cluster.htm";
else
if (a.plaza.value = 3 && a.tipo.value = 1)
documento = "merida_cond.htm";
else
if (a.plaza.value = 4 && a.tipo.value = 0)
documento = "culiacan_cluster.htm";
else
if (a.plaza.value = 4 && a.tipo.value = 1)
documento = "culiacan_cond.htm";
else
if (a.plaza.value = 5 && a.tipo.value = 0)
documento = "tijuana_cluster.htm";
else
if (a.plaza.value = 5 && a.tipo.value = 1)
documento = "tijuana_cond.htm";
else
if (a.plaza.value = 6 && a.tipo.value = 0)
documento = "puebla_cluster.htm";
else
if (a.plaza.value = 6 && a.tipo.value = 1) {
documento = "puebla_cond.htm";
else
if (a.plaza.value = 7 && a.tipo.value = 0) {
documento = "nvo_laredo_cluster.htm";
else
if (a.plaza.value = 7 && a.tipo.value = 1) {
documento = "nvo_laredo_cond.htm";
camino = (carpeta + '/' + documento + '#' + pregunta);

};
</script>
<noscript>
<p>Su navegador no soporta JavaScript&reg;</p>
</noscript>
</head>
<body>
<h1 class="toctitle">Plaza</h1>
<form name="formulario" action="" method="post" enctype="text/plain"
target="mainframe">
<table width="200" border="0">
<tr>
<td>Plaza</td>
<td><select name="plaza" id="plaza">
<option value=0>Monterrey</option>
<option value=1>Valle de México</option>
<option value=2>León</option>
<option value=3>Mérida</option>
<option value=4>Culiacán</option>
<option value=5>Tijuana</option>
<option value=6>Puebla</option>
<option value=7>Nuevo Laredo</option>
</select></td>
</tr>
<tr>
<td>
</td>
<td>
<input type="radio" name="tipo" id="tipo" value=0
checked>Clúster<br>
<input type="radio" name="tipo" id="tipo" value=1>Condiciones
</td>
</tr>
<tr>
<td>Pregunta</td>
<td><select name="pregunta" id="pregunta">
<option value=0>Plaza</option>
<!-- ¿Filtros? -->
<option value=1>F1</option>
<option value=2>F2</option>
<!-- Preguntas -->
<option value=3>1</option>
<option value=4>2</option>
<option value=5>3</option>
<option value=6>4</option>
<option value=7>5</option>
<option value=8>6</option>
<option value=9>7</option>
<option value=10>8</option>
<option value=11>9</option>
<option value=12>10</option>
<option value=13>11</option>
<option value=14>12</option>
<option value=15>13</option>
<option value=16>14</option>
<option value=17>15</option>
<option value=18>16</option>
<option value=19>17</option>
<option value=20>18</option>
<option value=21>19</option>
<option value=22>20</option>
<option value=23>21</option>
<option value=24>22</option>
<option value=25>23</option>
<option value=26>24</option>
<option value=27>25</option>
<option value=28>26</option>
<option value=29>27</option>
<option value=30>28</option>
<option value=31>29</option>
<option value=32>30</option>
<option value=33>31</option>
<option value=34>32</option>
<option value=35>33</option>
<option value=36>34</option>
<option value=37>35</option>
<option value=38>36</option>
<option value=39>37</option>
<option value=40>38</option>
<option value=41>39</option>
<option value=42>40</option>
<option value=43>41</option>
<option value=44>42</option>
<option value=45>43</option>
<option value=46>44</option>
<option value=47>45</option>
<option value=48>46</option>
<option value=49>47</option>
<option value=50>48</option>
<option value=51>49</option>
<option value=52>50</option>
<option value=53>51</option>
<option value=54>52</option>
<option value=55>53</option>
<option value=56>54</option>
<option value=57>55</option>
<option value=58>56</option>
<option value=59>57</option>
<option value=60>58</option>
<option value=61>59</option>
<option value=62>60</option>
<option value=63>61</option>
<option value=64>62</option>
<option value=65>63</option>
<option value=66>64</option>
<option value=67>65</option>
<option value=68>66</option>
<option value=69>67</option>
<option value=70>68</option>
<option value=71>69</option>
<option value=72>70</option>
<option value=73>71</option>
<option value=74>72</option>
<option value=75>73</option>
<option value=76>74</option>
<option value=77>75</option>
<option value=78>76</option>
<option value=79>77</option>
<option value=80>78</option>
<option value=81>79</option>
<option value=82>80</option>
<option value=83>81</option>
<option value=84>82</option>
<option value=85>83</option>
<option value=86>84</option>
<option value=87>85</option>
<option value=88>86</option>
<option value=89>87</option>
<option value=90>88</option>
<option value=91>89</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Procesar"
onClick="proceso();"></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
<p> <br>
<br>
</p>
</body>
</html>

##### End of code

Aug 1 '05 #1
4 1401
JRS: In article <11**********************@g47g2000cwa.googlegroups .com>
, dated Mon, 1 Aug 2005 06:23:15, seen in news:comp.lang.javascript,
LinuxNT <fa***********@gmail.com> posted :
I have a problem with a javascript code. I attempt to program a mini
application with javascript. This application is part of a frameset.

I select three fields in this page and need that with this information
the javascript code compose an "URL" to put the desired page into the
frame named "mainframe".

My common errors are that this program don't put the desired page.
One error : the conditional equality test operator is ==, not = .

I need correct my code but I don't know very much of this language...
Can you help me? <script language="javascript">

<script type="text/javascript"> // is better
Your vast conditional replacement might be replaced by

var DOC = [
["monterrey_cluster.htm", "monterrey_cond.htm"],
// ...
["nvo_laredo_cluster.htm", "nvo_laredo_cond.htm"]
]

documento = DOC[+a.plaza.value][+a.tipo.value]
as it seems that the indexes are always valid.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Aug 1 '05 #2
Guy
bonjour,

LinuxNT a écrit:
Good mornin' colleagues!

I have a problem with a javascript code. I attempt to program a mini
application with javascript. This application is part of a frameset.

I select three fields in this page and need that with this information
the javascript code compose an "URL" to put the desired page into the
frame named "mainframe".

My common errors are that this program don't put the desired page.

camino = (carpeta + '/' + documento + '#' + pregunta);

try location.href below

parent.mainframe.location.href=carpeta + '/' + documento + '#' + pregunta;
GR
};
</script>
<noscript>


Aug 2 '05 #3
Good morning!

I had attempt all the changes suggested, but my script don't launch the
page requested.

As talks 1 a day ago: this code is a part of a frameset and I need that
the selected page to be displayed at frame "mainframe".

Thanks in advance again.

The code as follows:

# ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Estudio de Puntos de Venta y Centros de Consumo</title>
<meta CONTENT="text/html; charset=utf-8" HTTP-EQUIV="Content-Type"/>
<meta content="Resumen del &quot;Estudio de Puntos de Venta y Centros
de Consumo&quot;" name="description"/>
<meta content="" name="keywords"/>
<meta content="" name="author"/>
<meta content="lv******@velmark.com.mx" name="email"/>
<meta content="Velmark, S. A. de C. V., 2005" name="copyright"/>
<link type="text/css" rel="stylesheet" href="style.css"/>
<style type="text/css">
<!--
body {
background-color: #006699;
}
-->
</style>
<script type="text/javascript">
function proceso() {

a = document.formulario;
pregunta = a.pregunta.value;

var documento = '';
var carpeta = 'content';
var camino = '';
var DOC = [
["monterrey_cluster.htm", "monterrey_cond.htm"],
["v_mexico_cluster.htm", "v_mexico_cond.htm"],
["leon_cluster.htm", "leon_cond.htm"],
["merida_cluster.htm", "merida_cond.htm"],
["culiacan_cluster.htm", "culiacan_cond.htm"],
["tijuana_cluster.htm", "tijuana_cond.htm"],
["puebla_cluster.htm", "puebla_cond.htm"],
["nvo_laredo_cluster.htm", "nvo_laredo_cond.htm"]
];

documento = DOC[+a.plaza.value][+a.tipo.value];

camino = (carpeta + '/' + documento + '#' + pregunta);

};
</script>
<noscript>
<p>Su navegador no soporta JavaScript&reg;</p>
</noscript>
</head>
<body>
<h1 class="toctitle">Plaza</h1>

<!-- Inicia el Formulario -->
<form name="formulario" action="" method="post" enctype="text/plain"
target="mainframe">
<table width="200" border="0">
<tr>
<td>Plaza</td>

<!-- Se selecciona Plaza -->
<td><select name="plaza" id="plaza">
<option value=0>Monterrey</option>
<option value=1>Valle de México</option>
<option value=2>León</option>
<option value=3>Mérida</option>
<option value=4>Culiacán</option>
<option value=5>Tijuana</option>
<option value=6>Puebla</option>
<option value=7>Nuevo Laredo</option>
</select></td>
</tr>
<tr>
<td>
</td>
<td>

<!-- Se selecciona Tipo -->
<input type="radio" name="tipo" id="tipo" value=0
checked>Clúster<br>
<input type="radio" name="tipo" id="tipo" value=1>Condiciones
</td>
</tr>
<tr>
<td>Pregunta</td>

<!-- Se selecciona Pregunta -->
<td><select name="pregunta" id="select">
<option value=0>Plaza</option>
<!-- Filtros? -->
<option value=1>F1</option>
<option value=2>F2</option>
<!-- Preguntas -->
<option value=3>1</option>
<option value=4>2</option>
<option value=5>3</option>
<option value=6>4</option>
<option value=7>5</option>
<option value=8>6</option>
<option value=9>7</option>
<option value=10>8</option>
<option value=11>9</option>
<option value=12>10</option>
<option value=13>11</option>
<option value=14>12</option>
<option value=15>13</option>
<option value=16>14</option>
<option value=17>15</option>
<option value=18>16</option>
<option value=19>17</option>
<option value=20>18</option>
<option value=21>19</option>
<option value=22>20</option>
<option value=23>21</option>
<option value=24>22</option>
<option value=25>23</option>
<option value=26>24</option>
<option value=27>25</option>
<option value=28>26</option>
<option value=29>27</option>
<option value=30>28</option>
<option value=31>29</option>
<option value=32>30</option>
<option value=33>31</option>
<option value=34>32</option>
<option value=35>33</option>
<option value=36>34</option>
<option value=37>35</option>
<option value=38>36</option>
<option value=39>37</option>
<option value=40>38</option>
<option value=41>39</option>
<option value=42>40</option>
<option value=43>41</option>
<option value=44>42</option>
<option value=45>43</option>
<option value=46>44</option>
<option value=47>45</option>
<option value=48>46</option>
<option value=49>47</option>
<option value=50>48</option>
<option value=51>49</option>
<option value=52>50</option>
<option value=53>51</option>
<option value=54>52</option>
<option value=55>53</option>
<option value=56>54</option>
<option value=57>55</option>
<option value=58>56</option>
<option value=59>57</option>
<option value=60>58</option>
<option value=61>59</option>
<option value=62>60</option>
<option value=63>61</option>
<option value=64>62</option>
<option value=65>63</option>
<option value=66>64</option>
<option value=67>65</option>
<option value=68>66</option>
<option value=69>67</option>
<option value=70>68</option>
<option value=71>69</option>
<option value=72>70</option>
<option value=73>71</option>
<option value=74>72</option>
<option value=75>73</option>
<option value=76>74</option>
<option value=77>75</option>
<option value=78>76</option>
<option value=79>77</option>
<option value=80>78</option>
<option value=81>79</option>
<option value=82>80</option>
<option value=83>81</option>
<option value=84>82</option>
<option value=85>83</option>
<option value=86>84</option>
<option value=87>85</option>
<option value=88>86</option>
<option value=89>87</option>
<option value=90>88</option>
<option value=91>89</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>

<!-- Se envian valores al JavaScript -->
<td><input name="submit" type="submit" OnClick="proceso()"
value="Procesar"></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
<p> <br>
<br>
</p>
</body>
</html>
# ---

Aug 2 '05 #4
Hi, Guy!

With your contribution the program responses good!

Only exists a couple of things:

1. The script display an alert box message and say that the document
"undefined" is not exists.

2. The script at end, launch the same page of origin (tocframe2.htm) to
mainframe.

Thanks in advance for any suggestion.

Aug 2 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
4
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a form with multiple pages on it. There is one text field on the third page of the form that I need the user to complete before leaving the form or moving...
3
by: dixie | last post by:
I have an Access 2000 form which has been running OK for a long time. Lately, it is playing up and doing things like causing Access to close suddenly when the form is opened or when saving the form...
9
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
7
by: Frank Maxey | last post by:
I am fairly new to VB.Net and am having a curious problem. I have an entry dialog form called from a main form. The calling form needs to check the DialogResult field for an OK response. In...
7
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
7
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still...
1
by: swathichavalla | last post by:
Problem description: Clients working with an apple computer with the safari browser are experiencing problems with brokerage orders. When the client wants to enter a stock order, the order entry...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.