Click to See Complete Forum and Search --> : Internet Explorer


lglover241
12-10-2003, 11:00 AM
HELP!

I am trying to use _javascript inside a method to:
1. Navigate to a particular website
2. Once navigated get the Document and form
3. pass a variable and submit it to the form

Everything works fine when the website is up and running but if the website is down it will still try to "submit" on the particular url and throw an error. I have tried to research options on the web but without luck. I am getting frustrated and any help would be much appreciated.

Here is the code:
var IE = COMCreateObject ("InternetExplorer.Application"); THIS CREATES THE IE Object

IE.Visible = 1; THIS MAKES IT VISIBLE

IE.Navigate "website.com/page.jsp");
THIS NAVIGATES IE TO THE JSP PAGE

IE.Document.forms("formname").elements("element").value = passed variable;
THIS GETS THE FORM, ELEMENT AND SETS THE VALUE
IE.document.forms.submit();
THIS SUBMITS THE FORMHELP!

TheBearMay
12-10-2003, 11:53 AM
Have you looked at the try...catch syntax?

lglover241
12-10-2003, 11:55 AM
I tried surrounding the code using the Try catch and throw methods but it didn't work. The Error continued to show

fredmv
12-10-2003, 01:12 PM
Can you provide the full JavaScript code possibly? All you should need is something like:onerror = function() { return true; }

lglover241
12-10-2003, 01:35 PM
var count = 0;
var title;
var IE = COMCreateObject ("InternetExplorer.Application");
var variable = passedvariable

title = "TITLE";
IE.Navigate ("www.webpage.com/caseStat.jsp"

while(IE.Busy)
{
SElib.dynamicLink ("kernel32", "Sleep", STDCALL, 100); // let IE start up
count += 100;
if (count > 30000)
break;
}
SElib.dynamicLink ("kernel32", "Sleep", STDCALL, 100); // let IE start up
IE.Document.OnError = Navigation_Error_Function(); //returns variable called "sitedown"
if(sitedown != Y)
{
IE.Document.forms("formname").elements("element").value = Variable;
IE.document.forms("formname").submit();
}


var hWnd = IE.HWND;
IE.Visible = 1;

SElib.dynamicLink ("user32", "SetForegroundWindow", STDCALL, hWnd);
SElib.dynamicLink ("user32", "SetWindowTextA", STDCALL, hWnd, title);