posts - 44,  comments - 48,  trackbacks - 0

          1.one page:? action_demo.html

          <html>
          <head></head>
          <body>
          <form? name="input" action="html_form_action.html" method="get">
          Usename:
          <input type="text" name="user" value="admin"><input type="submit" value="Submit">
          </form>
          </body>
          </html>

          2.two page:? html_from_action.html

          <html>
          <head></head>
          <script language="javascript">
          function getparastr(strname)
          ? {
          ?? var hrefstr,pos,parastr,para,tempstr;
          ?? hrefstr = window.location.href;
          ?? pos = hrefstr.indexOf("?")
          ?? parastr = hrefstr.substring(pos+1);
          ?? para = parastr.split("&");
          ?? tempstr="";
          ?? for(i=0;i<para.length;i++)
          ?? {
          ??? tempstr = para[i];
          ??? pos = tempstr.indexOf("=");
          ??? if(tempstr.substring(0,pos) == strname)
          ??? {
          ???? return tempstr.substring(pos+1);
          ???? }
          ?? }
          ?? return null;
          ? }
          // 獲取program參數(shù)
          //var userstr = getparastr("user");
          //document.write(userstr);

          //用得到的值給form中的文本框賦值?
          function getname()
          {
          var userstr = getparastr("user");
          document.fr1.input.value=userstr;
          }

          </script>
          <body>
          <form name="fr1" >
          你的名字是:
          <input type="text" name="input" >
          <input type="button" name="bt1" value="查看用戶名" onclick="getname()">
          </form>
          </body>
          </html>

          posted on 2006-09-05 10:18 摩西 閱讀(5030) 評(píng)論(1)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 嘉荫县| 玉龙| 巩留县| 米易县| 贵港市| 聊城市| 南投市| 白沙| 崇阳县| 石棉县| 崇礼县| 泰州市| 监利县| 临沧市| 萨迦县| 镇沅| 永昌县| 东丰县| 衡山县| 海口市| 泸定县| 英超| 永昌县| 乐都县| 青川县| 磐安县| 吐鲁番市| 巴里| 扶余县| 商洛市| 谷城县| 军事| 鱼台县| 石家庄市| 石屏县| 黄骅市| 莱州市| 永德县| 临泽县| 黔南| 黔西|