I think you are right, try using __proto__ instead of prototype .
I made a test case, its working, of course using the __proto__ .
document.images[0].__proto__.prin tMessage = myFunction ;...
User Profile
Collapse
-
-
alhalayqa started a topic how to allow event bubbling if an intermediate handler stopped its propagationin Javascripthow to allow event bubbling if an intermediate handler stopped its propagation
hi,
in MSIE, you can attach onclick event to both anchor and document objects.
here is some code :
document.onclic k = function() {alert('documen t clicked ...'); }
<a href= " " onclick="clickH andler"></a>
function clickHandler(){
alert('anchor clicked ... ');
}
now, its supposed that if... -
prototype property and onclick event
Hi,
as you know, if I attach a property to the object prototype, it will be attached to all objects from the same instance.
example :
if I have a couple of images inside a document such as :
<img src=""/>
<img src=""/>
<img src=""/>
I can say : document.images[0].prototype.prin tMessage = myFunction ;
where is :... -
well, simply I want to detect which url will unload my current document, since beforeunload event could be stopped by the user (dialog box), then this would be annoying for users.
now, inside the unload event handler, could I know which url will replace my current document . of course I cann't stop the unload event, but at least I want to know the url .
thanks....Leave a comment:
-
-
if I understood you, simply in javascript you can say :
document.locati on = "http://example.com".
this is an assigment, so document.locati on is read/write property !!
in any case, and same for the window.location = "http://www.example.com ".
why the onpropertychang e event is not fired !!
could you please explain more .
thanks ....Leave a comment:
-
Ok , but do you think I can catch what the url being assinged to document.locati on inside the onbeforeunload handler ?
if you look at my example , document.locati on = "http://www.google.com" .
could I know that my document will be overwritten by http://www.google.com ?
thanks ....Leave a comment:
-
onpropertychange event is not fired when you change document location
Hello ,
I have attached the onpropertychang e event to my document as :
[CODE=javascript]// the handler function
function propertychangeH andler(){
alert('property change event...');
}
document.onprop ertychange=prop ertychangeHandl er;
// now, when I change the document.locati on as :
document.locati on="http://www.google.com" ;... -
what about method overriding such as :
window.confirm = function (){ }
I have tried that, but still the dailog box appears .
but are there any other ways to detect that this window will be unloaded . of course without any alerts or confirm boxs .
thanks ....Leave a comment:
-
hide onbeforeunload dialog box
Hi Guys,
I have attached the beforeunload event and its handler to the window as :
// this is FireFox only
window.addEvent Listener("befor eunload",before unloadHandler,f alse);
function beforeunloadHan dler(event){
event.returnVal ue="my message !";
}
now the string "my message !" will be display on a confirm dialog box ,...
No activity results to display
Show More
Leave a comment: