http://ly/a.html?id=20090526,我要把20090526显示在a.html网页的表格里,我已经做到这里了,下面该如何做?
<script>
urlinfo=window.location.href;
len=urlinfo.length;
offset=urlinfo.indexof("?");
newsidinfo=urlinfo.substring(offset,len);
newsids=newsidinfo.split("=");
newsid=newsids[1];
</script>就是不知道最后在表格中该如何显示newsid????
<td>????</td>

解决方案 »

  1.   


    <td id="t"></td>
    <script>
    document.getElementById("t").innerHTML = newsid;
    </script>
      

  2.   


    <td id="xxx"></td>
    <script>
    window.onload=function(){
       document.getElementById("xxx").innerHTML = newsid;
    }
    </script>
      

  3.   

    html后跟查询字符串是非法的,除非使用了url重写, 一下是.net的
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>无标题页</title>    </head>
    <body>
        <form id="form1" runat="server">
            <table width="200" border="1">
                <tr>
                    <td id="td1">
                        &nbsp;</td>
                </tr>
            </table>
        </form>
        <script type="text/javascript"> 
    var urlinfo=window.location.href; 
    var len=urlinfo.length; 
    var offset=urlinfo.indexOf("?"); 
    var newsidinfo=urlinfo.substring(offset,len); 
    var newsids=newsidinfo.split("="); 
    var newsid=newsids[1]; 
    document.getElementById('td1').innerHTML=newsid;
        </script>
    </body>
    </html>