www.webdeveloper.com
Results 1 to 3 of 3

Thread: Push button method

  1. #1
    Join Date
    Aug 2007
    Posts
    2

    Push button method

    Hello.
    I have the following problem.
    I have a web interface of an AP, like http://10.10.50.113
    In this page I have a reset button, where I can restart AP. When I push the button, in 8 seconds automatically page is restarted, therefore AP settings. When I push the button I see in the left down corner, a message like that:
    javascript: if (!validate(forms[0])) or something like that, but nothing else in the web link address, means only (http://10.10.50.113).

    Do you know if there is a possibility to make a script automatically when I load it to access the button, therefore reset the page? If yes, how? I mention I am a beginner in web script technology.

    Thanks in advance,
    Robert

  2. #2
    Join Date
    May 2005
    Location
    Dirty Jersey
    Posts
    1,403
    the closest you can get to your request is to mimic what the button does, and have something else do it instead.

    so, right click the page that has that "javascript:if(!validate(forms[0]))" stuff, view the source, find everything after "javascript:" and create a new script with a function that calls all that.

    e.g:

    Code:
    <html>
    <head>
    <script>
    function automatic()
    {
    if(!validate(forms[0]))
    //blah
    //blah
    //blah
    //blah
    //resets the page blah blah blah
    }
    </script>
    </head>
    <body>
    then assign that function to the onload attribute of the body tag of the page you created:

    Code:
    <body onload="automatic()">

    1. If you reply to my post, and your reply would then appear directly beneath my post, DON'T QUOTE MY ENTIRE POST!!! IT'S REDUNTANT!!! IT'S ASININE!!!! IT'S REDUNDANTLY ASININE!!!!! DON'T DO IT!!!!
    2. jQuery extends the functionality of JavaScript. If you don't know JavaScript, give up on that jQuery script and learn JavaScript. You'll save yourself a lot of frustration, I promise.
    3. Use the [code][/code] tags. Otherwise, you may be left wondering why no one responded to your eyesore of a thread.


  3. #3
    Join Date
    Aug 2007
    Posts
    2

    Still not work

    Hi aaron.martines.
    Thank you very much for your ideas, but still not work.
    I saved the AP page source, and in correspondent java script section I have only:
    "javascript:if(!validate(document.forms[0]));">Save Settings, where Save Settings is the button to reset.
    When I push "Save Settings" button, a new Page appear where it say to wait for 8 seconds for reset.If I press right button now and view source, I get something like that:

    <HTML>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <HEAD>
    <title></title>
    <script language="javascript">
    <!--
    var url=document.referrer;
    var page = '' ;
    var cnt=0;
    var d = new Date();
    var t = d.getTime();
    var z = d.getTimezoneOffset();
    var startTime = parseInt((t+500/1000-z*60)/1000);
    for( var i=0 ; i<url.length ; i++ )
    {
    if( url.charAt(i) == '/' )
    cnt++ ;
    if( cnt == 3 )
    break ;
    }

    page = url.substring(i+1,url.length);

    geturl =url.substring(7,i);
    // pagelength =page.length;
    getnotpagelength=page.indexOf("?");

    if (getnotpagelength == -1)
    {
    page = url.substring(i+1,url.length);
    }
    else
    {
    page =page.substring(0,getnotpagelength);
    }

    count = 0;
    lan_ipaddr='10.10.50.113';
    restore_defaults='0';
    wan_ipaddr='';

    function changeurl()
    {
    if(restore_defaults=='1')
    {
    parent.top.location.href ="http://192.168.1.246";
    return 1;
    }
    if('static'=='dhcp')
    {
    window.location.href ="http://"+ wan_ipaddr +"/"+ page +"";
    }
    else
    {

    if(geturl==lan_ipaddr )
    {
    window.location.href ="http://"+ lan_ipaddr +"/"+ page +"";
    }
    else
    {
    parent.top.location.href ="http://"+ lan_ipaddr +"";
    }
    }
    }

    function setTimer()
    {
    document.body.style.cursor = "wait" ;
    setInterval('changeurl()',15000);

    }

    function redirect()
    {
    document.location.href = document.referrer ;
    }

    //-->
    </script>

    </HEAD>
    <BODY bgColor=#FFFFFF topmargin="0" leftmargin="0" width=478 onLoad="setTimer();">
    <form name="form1" method="post" action="">


    <CENTER>
    <div align="left">
    <br><br>
    <font color="black" face="Verdana">
    </font><center>
    <h1 align="center">&nbsp;</h1>
    <p align="center">&nbsp;</p>
    <p align="center">&nbsp;</p>
    <p><font color="black" face="Verdana"><br>
    <font size="5" face="Verdana, Arial, Helvetica, sans-serif"><strong><font face="Arial, Helvetica, sans-serif">Settings are successful.</font></strong></font></font></p>
    <p><font color="black" face="Arial, Helvetica, sans-serif"><br>
    <font size="4">
    </th>
    </tr>
    You will be returned to the previous page after 8 seconds.</font></font>
    </p>
    </center>

    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    </div>
    </form>
    </body>
    </html>

    which I didn't know if there is some useful information to use and how.
    Sorry for so long message.

    Thanks in advance,
    Robert

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles