Ajax中主页加载分页面后,分页面js脚本不执行怎么办
本帖最后由 showbo 于 2013-04-22 17:12:36 编辑
            以下是小弟分页的代码
<table width="0" border="0" cellspacing="0" cellpadding="0" >
  <tr>
	<td valign="middle" align="center" width="160px" height="30px">
		用户名:<input id="BiaoDan_DenLu_UserName" size="10" class="input_out" type="text" onmousemove="this.className='input_move'" onmouseout="this.className='input_out'" />
	</td>
    <td valign="middle" align="center" width="160px">
		密码:<input id="BiaoDan_DenLu_UserNiMa" size="10" class="input_out" type="password" onmousemove="this.className='input_move'" onmouseout="this.className='input_out'" />
	</td>
    <td valign="middle" align="center" width="60">
		<script>
			document.write("<img style='cursor:pointer;' src='" + Address_Pic + "/Button_DengLu.gif' />");		
		</script>
	</td>
	<td align="center" valign="middle" width="160">
		 申 请 入 驻 | 找 回 密 码
	</td>
  </tr>
</table>
因为这里的
<script>
			document.write("<img style='cursor:pointer;' src='" + Address_Pic + "/Button_DengLu.gif' />");		
		</script>
没有执行
很是头痛
因为在很多地方都会用到这个图片地址变量Address_Pic
所以不希望在每个页面都上都写成
<img style='cursor:pointer;' src='LunTan/Images/XiTongPic/Button_DengLu.gif'/>
这样当图片位置改动了后要每个文件都去改很麻烦
如果把位置保存在一个变量Address_Pic里
这样只要改这个变量就可以了
              
              
------解决方案--------------------有没有试过用jquery 的$.ajax({});
------解决方案--------------------本帖最后由 showbo 于 2013-04-22 17:33:36 编辑
            慎用用document.write,如果文档流关闭后你再调用document.write会覆盖当前页面的内容。。
模板可以做成这样的,onload事件可以触发
<table width="0" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td valign="middle" align="center" width="160px" height="30px">
        用户名:<input id="BiaoDan_DenLu_UserName" size="10" class="input_out" type="text" onmousemove="this.className='input_move'" onmouseout="this.className='input_out'" />
    </td>
    <td valign="middle" align="center" width="160px">
        密码:<input id="BiaoDan_DenLu_UserNiMa" size="10" class="input_out" type="password" onmousemove="this.className='input_move'" onmouseout="this.className='input_out'" />
    </td>
    <td valign="middle" align="center" width="60">
<img style='cursor:pointer;' onload="this.onload=null;this.src=Address_Pic+'/Button_DengLu.gif'" src='一张默认的图片' /></td>
    <td align="center" valign="middle" width="160">
         申 请 入 驻 
------解决方案-------------------- 找 回 密 码
    </td>