473,396 Members | 1,832 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.

does this way to start a function not work with NS?

Hi,

This way to start a function works with IE; why doesn't it work with NS (7).

<input type="button" id="test">
<script>
function test.onclick()
{
....
}
</script>

thanks
dave
Jul 20 '05 #1
3 1322
"Dave" <no@dsfg.vb> writes:
This way to start a function works with IE; why doesn't it work with NS (7).
Why should it?

Because Mozilla (which Netscape 7 is based on) follows the ECMAScript
standard for syntax, and what you have written isn't correct.
<input type="button" id="test">
<script>
<script type="text/javæscript">
if you want to write HTML 4.
function test.onclick()


You can only write an identifier as a function name:
function testOnclick(){

You can then assign that to test.onclick either with a later
test.onclick = testOnclick
or directly with an anonymous function
test.onclick = function () {

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
> This way to start a function works with IE; why doesn't it work with NS (7).

<input type="button" id="test">
<script>
function test.onclick()
{
...
}
</script>


That form of function is not standard ECMAScript. It is a Microsoft extension.
If you want to run on other platforms, shun the Microsoft extensions.

Try this instead:

test.onclick = function (e) {
e = e || event;
...
};

http://www.crockford.com

Jul 20 '05 #3
thanks both
Jul 20 '05 #4

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

Similar topics

5
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
4
by: rick | last post by:
The following basic script works fine in firefox by not in IE. Can anyone spot the problem? In IE I can only delete the first line but not the lines created by javascript. Also, look at the HTML...
4
by: Ziggy | last post by:
The purpose of my application is to require a website visitor to complete a form before participating in a search application. I have a specific reason for doing this with client-side javascript,...
2
by: mark4asp | last post by:
Why does this not work in Mozilla ? <http://homepage.ntlworld.com/mark.pawelek/code/animals.html> The optHabitat_change() event does not fire. What am I doing wrong here? PS: It should...
5
by: Rashad Rivera | last post by:
I need to know why the Application_Start function fires twice when it initializes. It is doing double work and messing up my process. Thanks for your help - Rashad
21
by: Willie jan | last post by:
place this behind a button that fills a listbox. as you will see the time is now and then 0 or filled in???????????? by hitting the button. is there a way to determine the real elapsed time? ...
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
8
by: Matthew Wells | last post by:
Hello, I'm working on an ASP.net 2.0 web project using VS 2005. I'm on my laptop running IIS on WinXP SP2 with all the latest updates. The Default web site is set to run on .net 2.0 My...
2
chunk1978
by: chunk1978 | last post by:
i wrote a custom PHP script last year and everything worked perfectly... recently my webserver upgraded to PHP 5 and now my script doesn't work properly. what the script does is: users fill out...
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
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
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
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
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...
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,...

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.