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參數
          //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 摩西 閱讀(5037) 評論(1)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 九江县| 泌阳县| 朝阳县| 田阳县| 栖霞市| 大方县| 沙田区| 徐汇区| 邹平县| 萨迦县| 英吉沙县| 金秀| 灵台县| 广西| 六枝特区| 天全县| 定陶县| 包头市| 兴海县| 醴陵市| 泗洪县| 永胜县| 武宁县| 侯马市| 崇左市| 嘉兴市| 得荣县| 公主岭市| 绵阳市| 晋城| 大悟县| 贵德县| 枞阳县| 荥经县| 富川| 墨玉县| 屏边| 墨江| 陵水| 乌恰县| 广河县|