首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

急送分·在.cs文件中怎么调用.aspx中的js脚本

2012-02-20 
急送分在.cs文件中如何调用.aspx中的js脚本?.cs---...Response.Write( inputtype buttonvalue button

急送分·在.cs文件中如何调用.aspx中的js脚本?
.cs
---
...
Response.Write( " <input   type= 'button '   value= 'button '   onclick= 'alt() '   /> ");
Response.Write( " <a   href= '# '   onclick= 'alt() '> getUrl# </a> ");
...

.aspx
---
...
<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
        <link   href= "StyleSheet_1.css "   rel= "stylesheet "   type= "text/css "   />
        <script   type= "text/jscript ">
        function   alt()
        {
                //var   Vname   =   document.getElementById( "name0 ").value;
                alert( "info... ");
        }
        </script>
</head>
<body>
...
------
在.cs中 <a   ...> 是可以正常调用的,但是唯独 <input...> 调用不成功,请朋友们指点一下。

[解决办法]
alt()问题在此!
alt是JS中关键字,请避免使用关键字做变量声明或函数名。
请把此函数名改一下即可。
------------------------------------------------Alt属性(注意是“属性”而不是“标签”)包括替换说明,对于图像和图像热点是必须的。它只能用在img、area和input元素中(包括applet元素)。对于input元素,alt属性意在用来替换提交按钮的图片。比如: <input type= "image " src= "image.gif " alt= "Submit " /> ...

热点排行