Java pop up - how to "press" the OK button??

cav609

New Member
Joined
Nov 7, 2005
Messages
13
Hi

I'm trying to submit data to a web form. On entering the data into a text form on the web page, the data is then displayed in a java pop up window, asking for confirmation to enter. The java pop up has 2 buttons: OK and Cancel. I need to somehow refernce the OK button and click it, but cant decipher the javascript - no button references that look like they may belong to the OK button in the code that I can see?? Anyway, some of what I believe is the relevant HTML code below - any ideas gratefully receved!!

cav

Code:
</TD></TR></TABLE>

<script language='javascript'>
 document.domain='advfn.com';
</script>
<script language='javascript'>
<!--
        function doSubmit()
        {
            val = document.forms[0].btn.value;
            add = document.forms[0].add.value;
            mid = document.forms[0].mid.value;

            if (val=="go"){
                openDialog( 'http://www.advfn.com/p.php?pid=m_add&replace=1&add='+add+'&mid='+mid+'&cb=1134933464' , 'Add Stocks' , '450', '200');            }
        }
    var jsWindow = null;

function openDialog(url , title , width , height)
{
//center on current window
    var x,y,w,h;
    if(document.all)
    {
        x =  window.screenLeft;
        y =  window.screenTop;
        w =  window.document.body.clientWidth;
        h =  window.document.body.clientHeight;
    }
    else
    {
        x = window.screenX;
        y = window.screenY;
        w = window.outerWidth;
        h = window.outerHeight;
    }
    //alert( x+"," + y + ","+w +","+h);

    x += Math.round( (w - width )/2 );
    y += Math.round( (h - height )/2 );
//    

      /*
      if(jsWindow!=null)
        jsWindow.close();
      */
      var temp = ( Math.round(Math.random() * 10000) ) .toString();
/**** this code does not work on all browsers
      jsWindow=window.open("about:blank","mon"+temp+"1134933464","top="+y+",left="+x+",screenX="+x+",screenY="+y+",width="+ width +",height="+height+",resizable,scrollbars");
      jsWindow.document.open();
      jsWindow.document.write("<html><head><LINK rel='stylesheet' href='/style.css'></LINK><title>ADVFN.com--</title></head>"+
                 "<frameset rows='*,35' border='0'>"+
                 "<frame name='mtop' src='"+ url+"' scrolling='yes'>"+
                 "<frame name='mbot' src='/jsdialog.html' scrolling='no' noresize>"+
                 "</frameset></html>");
      jsWindow.document.close();
*/
	  jsWindow = window.open("/p.php?pid=dialog_container&title=&url="+escape(url), "mon"+temp+"1134933464","top="+y+",left="+x+",screenX="+x+",screenY="+y+",width="+ width +",height="+height+",resizable,scrollbars");
      jsWindow.focus();
}
 
Well, the Excel question is I'm running this from an excel procedure - or not when it comes to the java pop up!

The procedure is based on Nate's excellent code for looging into a web site, and referencing the relevant username and password buttons to enter the appropriate login which can be found here:

http://mrexcel.com/board2/viewtopic.php?t=106985&postdays=0&postorder=asc&start=10

Using code in the form of

With .Document.forms(0)
.username.Value = "my username"
.password.Value = "my password"
.login.Click
End With

gets me to the data input page, but then the java pop up appears. I was hoping to use the above technique to hit the OK button on the pop up but ... [see the beginning of my post]

Hope that clarifies

Any help gratefully received

cav
 
Upvote 0
What gets you to the popup?

You want to avoid the popup, whether that means hacking to the resulting url or navigating on a Java Function, e.g.,

http://www.mrexcel.com/board2/viewtopic.php?p=884522#884522

Focus on this:

Code:
.navigate "JavaScript:if (fnValidate()) document.HorseSearchForm.submit();"
Also, it might help us if you didn't dump a ton of HTML into a post for us to sift through. Can you put some effort into streamlining the relevant bits.

What you're asking about is somewhat advanced, so you'll need be prepared to do some advanced work and research, keeping your wits about you.

Also, can you post on a single subject in a single thread versus many threads? I thank you in advance.
 
Upvote 0
Hmmm, you might just want to navigate on this:

Code:
.navigate "doSubmit()"
Test it and see if you avoid the popup that way... Not sure, I don't speak JS...
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top