以下是我在母板(masterpage.master)里中加的一段代码。我做的是一个供求信息网。想用下面的代码实现在所有页面都有一个“我要发布”的连接。但是一加上就有错误。找开masterpage.master时只能打开source面,desgin面总是打不开,说是因为页面有错/。不过还能运行。只是defual.aspx页面的这个“我要发布”连接不能用。其他页面的连接都能打开。 
<script language="JavaScript1.2"> 
function move(x) { 
if (document.all) { 
object1.style.pixelLeft += x; 
object1.style.visibility = "visible"} 
else if (document.layers) { 
document.object1.left += x; 
document.object1.visibility = "show"}}; 
function makeStatic() { 
if (document.all) {object1.style.pixelTop=document.body.scrollTop+20} 
else {eval(document.object1.top=eval(window.pageYOffset+20));} 
setTimeout("makeStatic()",0);} 
</script> 
<script language="JavaScript1.2"> 
function positionmenu(){ 
move(-100) 

if (document.all) {document.write(' <DIV ID="object1" style="visibility:hidden;cursor:hand; Position : Absolute ;Left : 100px ;Top : 120px ;100 : 120">')} 
</script> 
<table border="0" cellpadding="0" cellspacing="0" width="115" bgcolor="#000000"> 
<script language="JavaScript1.2"> <!-- 
if (document.all||document.layers) { 
makeStatic();} 
var text=new Array(); 
var thelink=new Array(); 
text[0]=""; 
thelink[0]="../infoadd.aspx"; 
var linktarget='' 
function navigateie(which){ 
if (linktarget=='') 
window.location=thelink[which] 
else if (linktarget=='new') 
window.open(thelink[which]) 
else{ 
temp_var=eval("window.parent."+linktarget) 
temp_var.location=thelink[which] 


for (i=0;i <=text.length-1;i++) 
if (document.all) {document.write(' <TR> <TD height=159 background=images/fabu.gif onclick="navigateie('+i+')" onmouseover="className=\'hl\'" onmouseout="className=\'n\'"> <FONT SIZE=2 FACE=ARIAL>&nbsp;'+text[i]+' </FONT> </TD> </TR>')} 
else {document.write(' <TR> <TD background="images/fabu.gif"> <ILAYER> <LAYER HEIGHT="18" width=131> <FONT SIZE=2 FACE=ARIAL>&nbsp; <A HREF="'+thelink[i]+'" target="'+linktarget+'" id="nounderline">'+text[i]+' </A> </FONT> </LAYER> </ILAYER> </TD> </TR>')} 
</script> 
<tr> 
<td bgcolor="#0099FF"> <font size="1" face="Arial"> </font> </td> 
</TR> 
</table> 
<script language="JavaScript1.2"> 
if (document.all) {document.write(' </DIV>')} 
window.onload=positionmenu 
</script> 
请大家帮忙。谢谢

解决方案 »

  1.   

    <script language="JavaScript1.2"> <!-- 注释结束标记??
      

  2.   

    母板页用js是有点问题的,
    据我所遇到的情况,在js中调用页面控件的id时,
    要用<%= %>
    例如对TextBox1进行赋值,应该写成:
    document.getElementById("<%= TextBox1.ClientID %>").value = "aaaa";
      

  3.   

    三楼说的是这,删了试试
    <script language="JavaScript1.2"> 
    function move(x) { 
    if (document.all) { 
    object1.style.pixelLeft += x; 
    object1.style.visibility = "visible"} 
    else if (document.layers) { 
    document.object1.left += x; 
    document.object1.visibility = "show"}}; 
    function makeStatic() { 
    if (document.all) {object1.style.pixelTop=document.body.scrollTop+20} 
    else {eval(document.object1.top=eval(window.pageYOffset+20));} 
    setTimeout("makeStatic()",0);} 
    </script> 
    <script language="JavaScript1.2"> 
    function positionmenu(){ 
    move(-100) 

    if (document.all) {document.write(' <DIV ID="object1" style="visibility:hidden;cursor:hand; Position : Absolute ;Left : 100px ;Top : 120px ;100 : 120">')} 
    </script> 
    <table border="0" cellpadding="0" cellspacing="0" width="115" bgcolor="#000000"> 
    <script language="JavaScript1.2"> <!-- 
    if (document.all||document.layers) { 
    makeStatic();} 
    var text=new Array(); 
    var thelink=new Array(); 
    text[0]=""; 
    thelink[0]="../infoadd.aspx"; 
    var linktarget='' 
    function navigateie(which){ 
    if (linktarget=='') 
    window.location=thelink[which] 
    else if (linktarget=='new') 
    window.open(thelink[which]) 
    else{ 
    temp_var=eval("window.parent."+linktarget) 
    temp_var.location=thelink[which] 


    for (i=0;i <=text.length-1;i++) 
    if (document.all) {document.write(' <TR> <TD height=159 background=images/fabu.gif onclick="navigateie('+i+')" onmouseover="className=\'hl\'" onmouseout="className=\'n\'"> <FONT SIZE=2 FACE=ARIAL>&nbsp;'+text[i]+' </FONT> </TD> </TR>')} 
    else {document.write(' <TR> <TD background="images/fabu.gif"> <ILAYER> <LAYER HEIGHT="18" width=131> <FONT SIZE=2 FACE=ARIAL>&nbsp; <A HREF="'+thelink[i]+'" target="'+linktarget+'" id="nounderline">'+text[i]+' </A> </FONT> </LAYER> </ILAYER> </TD> </TR>')} 
    </script> 
    <tr> 
    <td bgcolor="#0099FF"> <font size="1" face="Arial"> </font> </td> 
    </TR> 
    </table> 
    <script language="JavaScript1.2"> 
    if (document.all) {document.write(' </DIV>')} 
    window.onload=positionmenu 
    </script>