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

Anonymous Functions / Mac Browser

TS
Does anyone know if the Mac Browsers (IE5 / Safari) support anonymous
functions or lambda functions? Ive been trying to get a site working
with the Mac browsers and just cant get it to work. Here is an example
of what Im trying to do:

function CSelect(sName, id, bmpReqRO, minOptions, onvalid, isAddr,
sLabel){
this.obj = document.getElementById(id);
this.focus = m_focus;
this.blur = m_blur;
this.disable = m_disable;
this.enable = m_enable;

//alert(sName);

var slct = makeProps(this, bmpReqRO, id);

//alert(slct.required);

if (navigator.appVersion.indexOf("Mac") > -1)
{
slct.options = slct.obj.options;
}
else
{
slct.options = obj.options;
}

slct.label = sLabel;
slct.minOptions = minOptions;
slct.type = "Select";
if(onvalid)
slct.onvalid = new Function(onvalid);
slct.getValue = function slct_getValue(){
return slct.obj.value
}
if(slct.readOnly){
slct.disable();
}
//if(slct.obj.getAttribute("OnSelect")){
//slct.obj.onchangeFunc = slct.obj.onchange;
//slct.obj.onchange = new Function("onItemSelect(this)");
//}

if (navigator.appVersion.indexOf("Mac") > -1)
{
if(slct.obj.getAttribute("OnSelect")){
obj.onchangeFunc = slct.obj.onchange;
// THIS LINE DOES NOT WORK WITH THE MAC
obj.onchange = new Function("onItemSelect(this)");
}
}
else
{
if(slct.obj.getAttribute("OnSelect")){
slct.obj.onchangeFunc = slct.obj.onchange;
slct.obj.onchange = new Function("onItemSelect(this)");
}
}
.. . . Continued . . .

function onItemSelect(oSelect){

var oSelected = oSelect[oSelect.selectedIndex];
var onselect = oSelected.getAttribute("onSelect");

if(oSelect.onChangeFunc)
oSelect.onChangeFunc();

if(onselect){
var oSelectedFunc = new Function(onselect);
oSelectedFunc();
}
}
Jul 20 '05 #1
6 5779
TS wrote:
Does anyone know if the Mac Browsers (IE5 / Safari) support anonymous
functions or lambda functions? Ive been trying to get a site working
with the Mac browsers and just cant get it to work. Here is an example
of what Im trying to do:

[...]
if (navigator.appVersion.indexOf("Mac") > -1)
Nonsense. Read <http://pointedears.de.vu/scripts/test/whatami>
{
if(slct.obj.getAttribute("OnSelect")){
Do not use getAttribute(...) but, because of flawed implementations,
access the property directly. Besides, I doubt that there is a
`OnSelect' property in the DOM. J(ava)Script ist case-sensitive, it
is most certainly `onselect'. And you should test then if the property
type is not undefined and the value is not null.
obj.onchangeFunc = slct.obj.onchange;
// THIS LINE DOES NOT WORK WITH THE MAC
"Does not work" is a useless error description. [psf 4.11]

Please read <3F**************@PointedEars.de>
obj.onchange = new Function("onItemSelect(this)");
If it is really the line that triggers the error it could also mean
that you cannot overwrite the `onchange' property in the used DOM.
Since you did not post the error message (see above), one can only guess.
PointedEars
-- does anyone have any info about how can i make an explorer type menu?

Care to be more specific? Windows Explorer? Internet Explorer? Jungle
Explorer? (Fabian in cljs, <br************@ID-174912.news.uni-berlin.de>)
Jul 20 '05 #2
In article <3F**************@PointedEars.de>, Thomas 'PointedEars' Lahn
<Po*********@web.de> writes:
Please read <3F**************@PointedEars.de>


Please use URL's to articles that anyone can gain access to. That does nothing
for me.
--
Randy
Jul 20 '05 #3
T S
I guess you kind of missed the point of my post. I really just wanted to
know if the Mac browser supported anonymous / lambda functions. I do not
get an error message at all, it just doesnt seem to recognize them. You
are right about the OnSelect not being part of the DOM, it is an
anonymous function of select object we created ourselves. It was
difficult to post all of the code.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4
T S wrote:
I guess you kind of missed the point of my post.
Well, you made it not difficult to miss it.
I really just wanted to know if the Mac browser supported anonymous /
lambda functions.
A simple test case will show that. No question here is necessary.

var x;
x = new Function("var y = 2;");
alert(x); // undefined?
I do not get an error message at all,
Then why do you ask? Either the Function constructor is supported or
it is not. If the latter, the mentioned line should either (better)
trigger a script error or the value of the property the return value
of the `new' operation is assigned to does not change.
it just doesnt seem to recognize them.
There can be numerous possibilities why the mentioned line does not
work. Maybe the event handler `onchange' it is not part of the DOM
and you have added merely a method being only manually invoked.
Debugging will show this, follow the message ID that I have posted.
You are right about the OnSelect not being part of the DOM, it is an
anonymous function of select object we created ourselves.


You missed the point. JavaScript ist *case-sensitive*. There may
be `onselect', but it is unlikely that there is `OnSelect'.
PointedEars
Jul 20 '05 #5
T S


Thanks for the response. I tried out your suggestion with the test
function and it seemed to work fine on MAC IE and Safari. So I guess
that answers my question about anonymous functions. I still get no
Javascript error when it processes, I just don't get the desired
results. I would love to be able to step through a debugger on this but
as far as I know one doesn't exist for MAC IE5 or Safari. Unfortunately
this all works really well on Windows IE so I can't debug it over there.
I tried the onselect change as well with no luck. I will continue to
look into and post any info as I gather it. Thanks again.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #6
> Thanks for the response. I tried out your suggestion with the test
function and it seemed to work fine on MAC IE and Safari. So I guess
that answers my question about anonymous functions. I still get no
Javascript error when it processes, I just don't get the desired
results. I would love to be able to step through a debugger on this but
as far as I know one doesn't exist for MAC IE5 or Safari. Unfortunately
this all works really well on Windows IE so I can't debug it over there.
I tried the onselect change as well with no luck. I will continue to
look into and post any info as I gather it. Thanks again.


My experience with IE Mac suggests that Microsoft did not put its smartest guys
on the Mac team. It is considerably bugger than the Windows browser. It has race
bugs. It will fail silently, or quit with a meaningless error message. It is
bad, bad stuff.

Jul 20 '05 #7

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

Similar topics

76
by: Nick Coghlan | last post by:
GvR has commented that he want to get rid of the lambda keyword for Python 3.0. Getting rid of lambda seems like a worthy goal, but I'd prefer to see it dropped in favour of a different syntax,...
6
by: Mark Brandyberry | last post by:
I have a bit of a problem with an overloaded operator that I'm writing that I have distilled down to an example in the code below. Essentially, I have an operator function (+=) that takes a...
1
by: Fred | last post by:
If I select Anonymous in IIS under Security for my application and provide a user other than IUSR which has permissions to create folders, etc. on another server, I am able to create the folder I...
1
by: iporter | last post by:
I have several functions with code along the lines of: var xmlDoc = requestXML("ajax.asp?SP=SelectRelatedTags&tag=" + array); The requestXML() function includes the code: var xmlDoc = null;...
60
by: jacob navia | last post by:
Gnu C features some interesting extensions, among others compound statements that return a value. For instance: ({ int y = foo(); int z; if (y>0) z = y; else z=-y; z; }) A block enclosed by...
3
by: Brian Adkins | last post by:
I found the results of the following code counter-intuitive: var N = 2000000; var c1 = 0, c2 = 0, t1, t2; t1 = new Date(); (function () { for (var i = 0; i < N; ++i) { c1++; }
10
by: Frank O'Hara | last post by:
Hello everyone, I'm just learning some of the depth that Javascript has to offer. I have to say that it is quite amazing. Anyway, I'm translating some of my older, classical code to try to take...
7
by: Gregor Kofler | last post by:
What is the best practice for removing anonymous functions? Something like (function() { doSomething(); arguments.callee = null; })(); seems to work (at least it triggers no errors or...
22
by: Luna Moon | last post by:
I am reading the book "C++ Annotations", and here is a quote from the book: Namespaces can be defined without a name. Such a namespace is anonymous and it restricts the visibility of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.