Sanjiv Jivan

Ranch Hand
+ Follow
since Nov 03, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sanjiv Jivan

I'm sorry, that was a typo in my previous post. I did pass 'visibility' and not 'visible', and the function returned "inherit".

Sanjiv
This code is in the prototype library (prototype.js) and works fine in many IE 6 browsers. The very same page just breaks on a couple of machines where I suspect the JS engine maybe older although the browser version is IE 6. Is there a quick way to determine the JS engine version.

I ran my code through a JS debugger and (typeof __method) returns "function".

Thanks,
Sanjiv
Unfortunately the above code isn't doing what I need.

elem.currentStyle evaluates to true in IE but elem.currentStyle["visible"] returns the String "inherit".

Sanjiv
There's a call in prototype
__method.call(object, event || window.event);

which works fine on several machines which have IE 6 however on a couple of them (also running IE 6) it throws the exception "Object doesn't support this property or method".

Any idea why I'm seeing this error? The "call(..)" function is part of JS, right? Or is it possible I have an older JS engine.

Thanks,
Sanjiv
I have a select box within a table and it has a td which is styled to be hidden. As a result, the contents of the td are also hidden. When I do an select element iteration the select elements style.visible property does not provide any info on whether the element is visible on the page or not (i'm assuming the default is inherit). Is there an easy way of determining this other than navigating thought all parents and testing the visible property?

Thanks,
Sanjiv
I was trying to write some OO Javascript where I have some code like

function Base() {}

Base.prototype.foo = function(){
..
}

Child.superclass = Base.prototype;

function Child(){}

Child.prototype.foo = function() {
Child.superclass.foo.call(this);
...
}

The foo() function in Child works on some IE JS versions, however I get a javascript error on some javascript versions stating that the "call" property is not defined in the line " Child.superclass.foo.call(this);"

I tried googling but could not find an definite answers as to which JS version the "call" functionality was introduced. Is there a better/alternate way to call a superclasses method?

Also is there a way to tell which JS version is running? The machine where I'm getting the error is also running IE 6, but seems to have an older JS version installed on it.

Thanks,
Sanjiv
[ June 02, 2006: Message edited by: Sanjiv Jivan ]
Christian,
Just wondering whay you're viewing this as anything different from simply client authentication (which could be either basic, form or client certificate authentication). Client certificate authentication may be a more secure form of authentication than basic or form, but its just one type of client authentication.

Sanjiv
DWR has a pretty good way to expose API's along with the ability to specify access control based on J2EE roles. See http://getahead.ltd.uk/dwr/security

Sanjiv
Who is Christian Gross and how come questions have started being specifically addressed to him lately. Just curious

Thanks,
Sanjiv
Nevermind, I figured it out. Closures did the trick.

Foo.prototype.alertEveryTenSeconds = function() {
//window.setInterval(this.alertName, 10000);
var _this = this;
window.setInterval(function() { _this.alertName() }, 10000);

}
Let me describe the problem with an example. Consider the following class definition.


function Foo() {
this.name = "bar";
}

Foo.prototype.alertName = function() {
alert(this.name);
}

Foo.prototype.alertEveryTenSeconds = function() {
window.setInterval(this.alertName, 10000);
}

var foo = new Foo();
foo.alertEveryTenSeconds();

The problem is that in the method alertEveryTenSeconds(), I want to call the method "alertName" using setInterval (or setTimeout) however then the method alertName is called, "this" refers the the caller which is the window object and not the instance of Foo.

So my question is how do I invoke a object function (which has references to 'this') using setInterval or setTimeout. I'm thinking closures but can't figure it out.

Thanks,
Sanjiv
I needed to include an external js file. Oddly

<script type="text/javascript" src="myfile.js" /> caused all script code after this declaration to not execute.

Changing the declaration to
<script type="text/javascript" src="myfile.js"></script> fixed the issue. Is there any reference to explain why the shorthand version of tag closing does not work in html?

Thanks,
Sanjiv
Try AppFuse or Ruby on Rails.

Sanjiv
I have an app that has two frames. Each frame is a separate web app running on the same web server. I was wondering if there's a way for some javascript code in one frame to override a function declared in the app running in the other frame.

Some more context info : I'm testing my app using Selenium which basically runs a browser bot in one frame and the real app in the other frame. Due to some issues that I've encountered only when running the app with the test runner, I need to slightly change the behaviour of a javascript function of my main app when running in test mode. I want to see if I can avoid changing the original javascript function in my web app (like adding a test that checks if a "selenium" frame exists) and instead have the selenium test runner extension code override my javascript function.

Thanks,
Sanjiv