Autor Beitrag
hybris42
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 17



BeitragVerfasst: Di 03.07.07 16:34 
Hallo Leute,
ich möchte mit einem Klick auf einem Button eine Javascript Aktion auf der Konfigurationsseite meines Routers ausführen.

Die Seite, auf der die Aktion durchgeführt werden soll: 192.168.0.1/pptpstatus.htm
Die Javascript Aktion sieht so aus:
ausblenden Quelltext
1:
2:
3:
4:
5:
<TD align="center">
<input type=hidden name=pptpAct value=0>                  
<input type=button value=' Connect ' onClick='pptpAction(this.form,1)'>
<input type=button value=' Disconnect ' onClick='pptpAction(this.form,2)'>
</TD>

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
function pptpAction(F,I) 
{
  d =parseInt(I.value, 10);
  F.pptpAct.value = I;
  F.submit();
}


Ich habe an sowas gedacht:
ausblenden Delphi-Quelltext
1:
ShellExecute(Handle, 'OPEN''http://192.168.0.1/pptpstatus.htm'nilnil, SW_SHOWNORMAL);					

Weiß aber nicht, wie ich die Javascript Aktion durchführen kann.

Bitte um Hilfe.
Silas
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 478

Windows XP Home
Delphi 2005, RAD Studio 2007, MASM32, FASM, SharpDevelop 3.0
BeitragVerfasst: Di 03.07.07 16:37 
Ist das JS denn in einer externen Datei untergebracht?

_________________
Religionskriege sind nur Streitigkeiten darüber, wer den cooleren imaginären Freund hat ;-)
hybris42 Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 17



BeitragVerfasst: Di 03.07.07 17:47 
user profile iconSilas hat folgendes geschrieben:
Ist das JS denn in einer externen Datei untergebracht?

hier mal der gesamte quelltext
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
<html>
<head>
<title>PPTP Status</title>
<meta http-equiv=refresh>
<link rel="stylesheet" href="form.css" type="text/css">
<META content=text/html;charset=iso-8859-1 http-equiv=content-type>
<META http-equiv='Pragma' CONTENT='no-cache'>
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">  
<!--<style type='text/css'></style>//-->
<script language=JavaScript>
function isIE()
{
    var browser = new Object();
    browser.version = parseInt(navigator.appVersion);
    browser.isNs = false;
    browser.isIe = false;
    if(navigator.appName.indexOf("Netscape") != -1)
      browser.isNs = true;
    else if(navigator.appName.indexOf("Microsoft") != -1)
      browser.isIe = true;
      
    if(browser.isNs)
      return false;
    else if (browser.isIe)
      return true;

}

function countTime()
{
  window.focus();
  var t=document.forms[0].connTime.value;
  var s=document.forms[0].connStatus.value;
  var g=document.forms[0].getIP.value;
  timeString='';

  if((s != 'Connected') && (g != 'OK')){
    window.setTimeout('Fresh()',5000);
  }
  if(s == 'Connected')
    window.setTimeout('Fresh()',60000);
}

function pptpAction(F,I) 
{
  d =parseInt(I.value, 10);
  F.pptpAct.value = I;
  F.submit();
}

function Fresh() 
{
  parent.location = "pptpstatus.htm";
}
</script>
</head>

<body  bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text=black onLoad="countTime()">
<center><br>
<form method="post" action="/post-query">

<input type=hidden name="Load" value="Q">
<FONT face="Arial, Helvetica, sans-serif" size=3><B></B></FONT>
<table width=100% border=1 cellspacing=1 cellpadding=5>

  <tr>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2><B>Connection time</B></FONT></td>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2>
  00:00:00
      </FONT></td>
  </tr>
  
  <tr>

    <td><FONT face="Arial, Helvetica, sans-serif" size=2><B>Connecting to server</B></FONT></td>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2>Idle</FONT></td>
  </tr>
  <tr>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2><B>Negotiation</B></FONT></td>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2>---</FONT></td>
  </tr>

  <tr>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2><B>Authentication</B></FONT></td>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2>---</FONT></td>
  </tr>
  <tr>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2><B>Getting IP address</B></FONT></td>
    <td><FONT face="Arial, Helvetica, sans-serif" size=2>---</FONT></td>

  </tr>
  <input type=hidden name=connTime value=00:00:00>
  <input type=hidden name=connStatus value=Disconnected>
  <input type=hidden name=getIP value=--->  
</table>
  <p>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=250>
  <TBODY>
      <TR>
      <input type=hidden name=pptpAct value=0>

              <TD align="center">
                  <input type=button value=' Connect ' onClick='pptpAction(this.form,1)'>
                    <input type=button value=' Disconnect ' onClick='pptpAction(this.form,2)'>
                </TD>
    </TR>
  </TBODY>
</TABLE>
                    
<table width=100% border=0 cellspacing=0 cellpadding=0> 
  <tr width="100%">
    <td>

          <img src="img/liteblue.gif" width="100%" height="2" border="0"> 
              <center>
                  <input type=button name="close" value="Close Window" onclick="window.close();">
        </center>  
        </td>
    </tr> 
  <input type=hidden name="Button" value="Apply">
</table>
</form>
</center>
</body>
</html>
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Di 03.07.07 17:54 
Frag den da: www.delphipraxis.net...button+druecken.html

Oder machs mit TWebBrowser und simuliere den Klick auf den Button.

MfG
hybris42 Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 17



BeitragVerfasst: Di 03.07.07 18:04 
user profile iconCoder hat folgendes geschrieben:
Frag den da: www.delphipraxis.net...button+druecken.html

Oder machs mit TWebBrowser und simuliere den Klick auf den Button.

MfG


wie kann man denn sowas "simulieren"?
darauf will ich ja hinaus ..
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Di 03.07.07 18:42 
user profile iconhybris42 hat folgendes geschrieben:
user profile iconCoder hat folgendes geschrieben:
Frag den da: www.delphipraxis.net...button+druecken.html

Oder machs mit TWebBrowser und simuliere den Klick auf den Button.

MfG


wie kann man denn sowas "simulieren"?
darauf will ich ja hinaus ..

Suche in der Entwickler-Ecke MAUSKLICK SIMULIEREN

Anderer Vorschlag: Du nimmst einen TWebBrowser und resized und scrollst ihn so, dass nur die Buttons zu sehen sind.
Ziemlich unsauber, aber ist die einzige Möglichkeit die mir einfällt.