(Problem of value returned by COM, from IE, with prototype.js)



Hi!

I have this file (C:\titi.htm):

<html><body>
<script language="JavaScript" type="text/javascript">
montableau = new Array(111,222,333,444);
function visu(txt){ alert(txt +":"+montableau);}
</script>
</body></html>



I call it, with (Python version):

import win32com.client
ie=win32com.client.Dispatch('InternetExplorer.Application')
ie.Navigate('file:///C:/titi.htm')
ie.Visible=True
win=ie.Document.parentWindow
print win.montableau[1]    #==> show 222


Or, with this JScript  (launch like:  CSCRIPT  toto.js):

var ie = new ActiveXObject("InternetExplorer.Application");
ie.Navigate('file:///C:/titi.htm');
ie.Visible=1;
var win=ie.Document.parentWindow;
WScript.StdOut.Write(win.montableau[1]);    //==> show 222



it's OK.

BUT...


If I add prototype.js, the firt file ((C:\titi.htm) become:

<html><body>
<script type="text/javascript" src="prototype.js"></script>
<script language="JavaScript" type="text/javascript">
montableau = new Array(111,222,333,444);
function visu(txt){ alert(txt +":"+montableau);}
</script>
</body></html>


And with the SAME scripts, I obtain:

with JScript:   222

with Python:
"function(item, i) {
 i || (i = 0);
 var length = this.length;
 if (i < 0) i = length + i;
 for (; i < length; i++)
   if (this[i] === item) return i;
 return -1;
}"



OK, prototype.js add methods to Array.
But, why the difference between Jscript & Python? And how get the good value/object from Python; after prototype.js?


Thanks by advance.  And, sorry for my primitive/simplist/bad english.
--
Michel Claveau



_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to