从URL子字符串中提取日期

时间:2015-03-13 02:57:12

标签: javascript url substring

所以我试图从URL子字符串中提取数据......... 但是我一直在讨论引用我的数据变量“引用错误:未定义数据”并且没有出现任何数据的问题。 任何人都有任何想法,我搞砸了???

body {margin: 0px; background: white url(back.jpg) repeat-y scroll 0px 0px}
#head {position: absolute; top: 0px; left: 130px; background-color: black; padding: 0px; width: 100%;
       padding: 0px}
#links {position: absolute; top: 105px; left: 0px}
#edge {position: absolute; top: 105px; left: 130px}

#main {position: absolute; top: 120px; left: 160px; width: 510px;
       font-family: Arial, Helvetica, sans-serif}


#main p {font-size: 9pt}
#main #intro {text-align: right}

table#summary {width: 510px; font-size: 9pt; padding: 5px;
               border-top: 1px solid black;
               border-bottom: 1px solid black}
table#summary h3 {margin: 0px}

td {vertical-align: top}
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

   <title>Conference Summary Page</title>
   <link href="summary.css" rel="stylesheet" type="text/css" />
   <script src = "report.js" type = "text/javascript">
    var searchString = location.search.slice(1);
    var formString = searchString.replace(/\+/g, " ");
    var dataString = unescape(formString);
    var data = new Array(formString.split(/[&=]/g));
   </script>

</head>

<body>
   <div id="links"><img src="links.jpg" alt="" /></div>
   <div id="head"><img src="logo.jpg" alt="CGIP Annual Conference" /></div>
   <div id="edge"><img src="edge.jpg" alt="" /></div>

   <div id="main">
   <p id="intro">
      <b>10th Annual Conference of Computer Graphics and Image Processing</b><br />
         University of Colorado, Boulder<br />
         March 3 - March 7<br />
         Conference Fee: $145
   </p>

   <table id="summary">
      <tr><td colspan="2"><h3>Registration Summary</h3></td></tr>
      <tr>
         <td>Total Conference Cost:</td>
         <td>
            <script type="text/javascript">
                 document.write("$" + data[1]);
            </script>
         </td>
      </tr>
      <tr>
         <td>Name:</td>
         <td>
            <script type="text/javascript">
                 document.write(data[3] + " " + dataArray[5]);
            </script>
         </td>
      </tr>
      <tr>
         <td>Address:</td>
         <td>
            <script type="text/javascript">
              reg = /[\n]/g;
              var address = data[7].replace(reg,"<br />");
             document.write(address);
            </script>
         </td>
      </tr>
      <tr>
        <td>E-mail:</td>
        <td>
           <script type="text/javascript">
            document.write(data[9]);
           </script>
        </td>
      </tr>
      <tr>
         <td>Phone:</td>
         <td>
           <script type="text/javascript">
            document.write( "(" + data[11] + ")" + data[13] + "-" + data[15]);
           </script>
         </td>
     </tr>
     <tr>
        <td>Attending Banquet ($30 per person):</td>
        <td>
           <script type="text/javascript">
            document.write(data[17]);
           </script>
        </td>
     </tr>
     <tr>
        <td>ACGIP Member (save $25):</td>
        <td>
           <script type="text/javascript">
            document.write(data[19]);
           </script>
        </td>
     </tr>
  </table>

  <p>Print this page and retain it for your records.</p>

  </div>

</body>
</html>

0 个答案:

没有答案