473,799 Members | 3,255 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

in firefox the select with value null not work good

if I insert a string null in a select,
it change position; why?
I insert value "" in 2nd 3th select;

<style type="text/css">
td {border:2px solid pink;};
</style>

<table border="1">

<script type="text/javascript">

var dati1=new Array();
var dati2=new Array();
var dati3=new Array();
var dati4=new Array();
var counter=0;

function invia_dati()
{ //SELECT
var select1=documen t.form2.sel1 ;
var select2=documen t.form2.sel2 ;
var select3=documen t.form2.sel3 ;
var select4=documen t.form2.sel4 ;

dati1[counter]=[1];
dati2[counter]=[""];
dati3[counter]=[""];
dati4[counter]=[1];

var aa=0;
for (var i = 0; i <1; i++)
{select1.option s[aa]=new Option( dati1[i],dati1[i]);
select2.options[aa]=new Option( dati2[i],dati2[i]);
select3.options[aa]=new Option( dati3[i],dati3[i]);
select4.options[aa]=new Option( dati4[i],dati4[i]);
aa++;}

counter++;
}

</script>

<tr>
<td colspan="4">
<br />
</td>
</tr>

<form method="post" name="form1" action="" >
<tr >
<td colspan="4">
<input type="button" name="bottons" value="CERCA"
onClick="invia_ dati();"/>
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
</form>
<form method="post" name="form2" action="" >
<tr>
<td>
<select name="sel1" size="20" style="width:10 0px" multiple></select>
</td>
<td>
<select name="sel2" size="20" style="width:10 0px"></select>
</td>
<td>
<select name="sel3" size="20" style="width:10 0px"></select>
</td>
<td>
<select name="sel4" size="20" style="width:10 0px"></select>
</td>
<td>
<select name="sel5a" size="20" style="width:10 0px"></select>
</td>
<td>
<select name="sel5b" size="20" style="width:10 0px"></select>
</td>
<td>
<select name="sel5c" size="20" style="width:10 0px"></select>
</td>
<td>
<select name="sel5d" size="20" style="width:10 0px"></select>
</td>

</tr>

</form>
</table>
Jun 20 '07 #1
2 2194
On Jun 20, 9:59 pm, artev <mailnotspa...@ notspamm.nnwrot e:
if I insert a string null in a select,
it change position; why?
I insert value "" in 2nd 3th select;
When posting code, please indent using 2 or 4 spaces and manually wrap
it at about 70 characters.
>
<style type="text/css">
td {border:2px solid pink;};
That final semi-colon is a syntax error in CSS.

</style>

<table border="1">

<script type="text/javascript">
It is always good to start with valid HTML. A script element can't be
a child of a table or tbody element in HTML 4.
>
var dati1=new Array();
var dati2=new Array();
var dati3=new Array();
var dati4=new Array();
var counter=0;

function invia_dati()
{ //SELECT
var select1=documen t.form2.sel1 ;
var select2=documen t.form2.sel2 ;
var select3=documen t.form2.sel3 ;
var select4=documen t.form2.sel4 ;
dati1[counter]=[1];
dati2[counter]=[""];
That makes the value an array of one element, whose value is an empty
string. It is not "null".
dati3[counter]=[""];
dati4[counter]=[1];

var aa=0;
for (var i = 0; i <1; i++)
{select1.option s[aa]=new Option( dati1[i],dati1[i]);
select2.options[aa]=new Option( dati2[i],dati2[i]);
You are depending on the toString method of Array to return your
values, better to be more explicit:

{select1.option s[aa]=new Option( dati1[i][0],dati1[i][0]);
select2.options[aa]=new Option( dati2[i][0],dati2[i][0]);

There doesn't seem much point to an array of one element, but maybe
you intend to put more values in there.

select3.options[aa]=new Option( dati3[i],dati3[i]);
select4.options[aa]=new Option( dati4[i],dati4[i]);
aa++;}

counter++;

}

</script>

<tr>
<td colspan="4">
<br />
</td>
</tr>

<form method="post" name="form1" action="" >
More invalid HTML: a form element can't be a child of a table or
tbody. A simple solution is to put the table inside the form.
<tr >
<td colspan="4">
<input type="button" name="bottons" value="CERCA"
onClick="invia_ dati();"/>
</td>
</tr>
<tr>
</tr>
Yet more invalid HTML - a tr must have at least one td element inside
it.
<tr>
</tr>
</form>

<form method="post" name="form2" action="" >
....another form where it's not allowed...
<tr>
<td>
<select name="sel1" size="20" style="width:10 0px" multiple></select>
....and select elements must have at least one option...

Fixing your HTML plus simplifying and tidying the example will likely
fix your errors. If not, post what you end up with.
--
Rob

Jun 20 '07 #2
><select name="sel1" size="20" style="width:10 0px" multiple></select>
>
...and select elements must have at least one option...
Fixing your HTML plus simplifying and tidying the example will likely
fix your errors. If not, post what you end up with.
this is only a code for make a test; I have simplified one original
that is more complex and take datas from a db;

so it is only for make a test but is efficient for this scope;

the test is this:
first see the page html how is;

after change this
dati2[counter]=[""];
dati3[counter]=[""];
in this
dati2[counter]=[1];
dati3[counter]=[1];

and you can notice that the select are all ok how position;
make thet est with firefox and IE;

Jun 20 '07 #3

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

Similar topics

7
6254
by: Jesper Stocholm | last post by:
I have som XML that link to an XSL-file to enable on-the-fly HTML-generation by e.g. IE or FireFox. The transformation actually works like a charm, but I have problems with changing line breaks in the XML to their html-equivilant <br/>. I use the XSL: <xsl:template name="break"> <xsl:param name="text" select="."/> <xsl:choose>
4
2471
by: ioneabu | last post by:
I am trying to do the basic task of setting a text field from the choice made from a select box. I learned how to code it from my O'Reilly Javascript reference which is a few years old. The code works as expected in Safari but not Firefox which is where I really need it to work primarily. Of course, I would like it to work everywhere. I would greatly appreciate it if someone could point out my error. I did check to make sure that all...
3
2930
by: Olivier Verdin | last post by:
Hi, I have a page with several Textboxes and several DropDownList. When I click on a 'save' button, it creates a record in a database. The page works fine under Internet Explorer. It does not work under FireFox. The dropdownlist are always selecting the zero index value. If I debug and I stop the program in the page_load, the dropdownlist are already set to zero index.
1
7625
by: richardscheff | last post by:
Video selector works for IE but not other browsers. for not IE <object ID='Player' data="video/dodgeball.wmv" type="video/x-ms-wmv" width="320" height="280"> <param name="filename" value="video/dodgeball.wmv" /> <param name="ShowControls\" value="1" /> <param name="AutoStart\" value="1" /> <param name="PlayCount\" value="1" />
3
14375
by: palak123i | last post by:
Hi All, I am using a javascript to submit a request using AJAX. Part of javascript code as follows: var favElement = document.getElementById('fav1'); alert(favElement); for (var i = 0; i < userGroupArray.length; i++){ for (var j = 0; j < favElement.length; j++){ if(favElement.options.value == userGroupArray){
11
2818
by: davecph | last post by:
I'm constructing a website with a layout created with div-tags. They have a fixed width, float left, and display inline. When one of the div's contain a select-element the right-most div floats down for no apparent reason, but when the select-elements are gone they all align as expected. No css apply to the select-elements. image of prob.: http://sdc.novasol.com/site/nov/TMP/withSelectBoxes.gif image of expected:...
5
6473
by: Faizmysore | last post by:
This code works good in IE, function multiuser() { document.frmOpenInteraction1.Create.disabled=true; document.frmOpenInteraction1.hidmultiuser.value="Yes"; var r = showModalDialog('popup.htm','NEW', 'dialogWidth:400px;dialogHeight:155px;dialogLeft:200px;center:1;help: no; resizable: no; status: no; scroll: no;'); window.document.frmOpenInteraction1.ticket.checked=false;...
1
1459
by: rjdougan | last post by:
I am not a developer but need some help with scripts for a client. I have a script to handle form validation and one that handle mouseover on menu. The form validation script works fine by it self in both Firefox and IE. When the menu mouseover script is introduced the form validation only works in firefox not in IE. Here is the form validation script ---------------------------------- function verifyForm(form_id) {
3
2435
by: SAL | last post by:
Hello, I did google this issue and found some stuff related to BrowserCaps section of either web.config or machine.config but it didn't work. It seems that most pages in my webapp are okay but a couple of the Firefox is munging up. So, on my information page there is a gridview in the content section of the page. The masterpage contains searching capabilities for the gridview. The masterpage has controls contained in a panel control,...
0
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10485
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10231
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9073
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.