|
|
| Author |
Message |
chwanyin
Joined: 13 Mar 2008
Posts: 1
|
Posted: Thu Mar 13, 2008 10:36 pm Post subject: Javascript in Firefox |
|
|
Dear Dir
i ran the following sample code in firefox. it doesn't work. How should i do to make it work in firefox? Thanks
function Launch(tool)
{
var newDiv = MainWindow.document.createElement("<DIV id=\"peekiaddition\"
style=\"position: absolute; right: 0px; top: 0px; width: 90px; padding-left: 4px; paddingbottom:
1px; z-index: 102; opacity: 0.7; filter: alpha(opacity=70); font-family: arial; fontsize:
10pt; font-weight: normal; color: #000000; background-color: #FFDD69;\">");
newDiv.innerText="Web access";
MainWindow.document.body.insertBefore(newDiv);
} |
|
| Back to top |
|
 |
Admin Site Admin
Joined: 22 Aug 2006
Posts: 1055
|
Posted: Fri Mar 14, 2008 6:25 am Post subject: |
|
|
There is no Mainwindow object for Firefox browser.
Please, find the differences between IE and FF in the Embedded help of ToolbarStudio/Firefox section |
|
| Back to top |
|
 |
blp330
Joined: 06 Mar 2008
Posts: 13
|
Posted: Wed Mar 19, 2008 3:41 am Post subject: |
|
|
There is no Mainwindow object for Firefox browser.
This is not mentioned even in ToolbarStudio/Firefox section.
The documentation almost is helpless.
So how programmer to know that? Try and error... a waste time job.
In my experience, you must try this:
| Code: |
function Launch(tool) {
var isIE;
var document = null;
try {
if(MainWindow != undefined) {
isIE = true;
document = MainWindow.document;
}
} catch(e) {
isIE = false;
document = tool.explorer.document;
}
var div = document.createElement(.........)
}
|
This is a terrible design to make programmer feel bad.
Some simple way ToolbarStudio should do is to make a global object MainWindow = tool.explorer in firefox, or export document object as global object and a global variable "isIE" to reduce our work.
This is a simple effort but it will make programmer feel better and easy to use this product.
If a product waste programmer's time more, more programmer will give it up.
I like this product, but in many aspect, it should be improved, especially in API design between IE and Firefox.
Thanks. |
|
| Back to top |
|
 |
Admin Site Admin
Joined: 22 Aug 2006
Posts: 1055
|
Posted: Wed Mar 19, 2008 7:44 am Post subject: |
|
|
| Please, also try tool.window instead. |
|
| Back to top |
|
 |
|