473,395 Members | 1,694 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,395 software developers and data experts.

how to get this script to work in mozilla

Jon
Hi all

I got this javascript/function i works fine in IE but not in firefox
Do'es anyone know why?

// When I load the page
<script for="window" event="onload()" language=javascript>
laddainrulltyp()
</script>

//The event
<select name="cborulltyp" size="1" onChange="laddainrulltyp()">
//The function
<script language=Javascript>
function laddainrulltyp()
{
formen.txtrulltyp.value =
formen.cborulltyp.options(formen.cborulltyp.select edIndex).text;
formen.txtrulltypid.value =
formen.cborulltyp.options(formen.cborulltyp.select edIndex).value;
}
</script>

--

Mvh
Jon

jo*************@comhem.se
Jul 23 '05 #1
4 1216


Jon wrote:
I got this javascript/function i works fine in IE but not in firefox
Do'es anyone know why?

// When I load the page
<script for="window" event="onload()" language=javascript>
laddainrulltyp()
</script>


<script type="text/javascript">
window.onload = function (evt) {
laddainrulltyp();
</script>
works with both IE and Mozilla and other browsers.
The whole <script for="..." event="..."> is not at all or not well
supported in browsers other than MSIE.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Jon
Hi Martin

Your load function works fine, thanks.

But the function that write into the textboxes(txtrulltyp,txtrulltypid)
does'nt work.
Got any idea what I'am doing wrong.

//This function
<script language=Javascript>
function laddainrulltyp()
{
formen.txtrulltyp.value
=formen.cborulltyp.options(formen.cborulltyp.selec tedIndex).text;
formen.txtrulltypid.value
=formen.cborulltyp.options(formen.cborulltyp.selec tedIndex).value;
}
</script>
Jul 23 '05 #3


Jon wrote:
<script language=Javascript>
function laddainrulltyp()
{
formen.txtrulltyp.value


If you want to address the element
<select name="selectName">
inside of the form
<form name="formName">
in a cross-browser way then use
var select= document.forms.formName.elements.selectName;
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4
Martin Honnen wrote:

Jon wrote: [...] If you want to address the element
<select name="selectName">
inside of the form
<form name="formName">
in a cross-browser way then use
var select= document.forms.formName.elements.selectName;


Or you can use:

document.forms['formName'].elements['selectName']

which allows a little more freedom in the names used. If you use
<form name="my.form" ...> you can't get a reference to it using

document.forms.my.form

but you can get at it using:

document.forms['my.form']

Similarly for other special characters that are tolerated in names but
may confuse access methods such as ":", "[]", etc.

Jul 23 '05 #5

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

Similar topics

2
by: Matthew | last post by:
Is there a javascript or alternative default fill friendly way for counting down the remaining characters left in a form box?
2
by: Ola Fjelddahl | last post by:
hi. I load a script dynamically and it works * everytime with IE6. * sometimes! with Mozilla1.5 <- makes me curious * never with Opera7.11 all tests on WindowsXP. With "sometimes" I mean
4
by: Derek | last post by:
I have the following script in a page and it gets an error in IE 6. Says something about an invalid argument but the line number doesn't help since I can't see the javascript code when viewing...
7
by: news frontiernet.net | last post by:
I have a project that uses mouse-over JS script to show and hide layers that works well in MSIE 6.0 and Opera. But, it does not work in NS nor Mozilla. It is here: ...
2
by: webbedfeet | last post by:
Hi I hope someone can help me. I have a client side form validation script which works perfectly in IE but clicking "Submit" in Mozilla does nothing - the form won't submit. Is there something I...
1
by: cwdjrxyz | last post by:
I am now writing many new pages in xhtml 1.1. They are served as true xhtml by setting the mime type of the server to application/xhtml+xml for the .xhtml extension. Since IE6 and some earlier...
5
by: Cleverbum | last post by:
I'm not really accustomed to string manipulation and so I was wondering if any of you could be any help i speeding up this script intended to change the format of some saved log information into a...
15
by: Lennart | last post by:
Hi folks, I have created an animated image gallery in dhtml. It works fine in Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag. The page is valid xhtml-strict but with a...
5
by: YaoBao | last post by:
Is any ColdFusion script I can put on my webpage that will create a search bar so people can type keywords to match it on the current page in my website? It will be exactly like the finder search bar...
6
by: RossRGK | last post by:
A script I've implemented is doing this annoying thing where it works in mozilla only if you have Firebug installed. I was all excited to find someone had solved what sounded like the same...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.