向JScript里面声明的var img赋值
从后台赋值...
高手来解答下吧...在线等你
从后台赋值...
高手来解答下吧...在线等你
解决方案 »
- ~~~~~~~~~~~~~~~~~~~~checkboxlist 的取消选中事件 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- GridView怎样绑定不同表中的不同字段
- Repeater怎么用
- asp记录集问题
- The type initializer for 'CrystalDecisions.CrystalReports.Engine.CRPE' threw an exception
- 全站异常问题!!高手请进!!!
- onrowdatabound 这个属性为什么在 aspx 的设计模式中有用 ,在 cs文件中gridview
- How to write javascript to display/hide <div>....</div> when buttons are clicked
- 今天公司来了五个实习生,四个MM,虽说不算漂亮,却也眉清目秀、身材窈窕 :)...
- 这种效果是怎么样做出来的???
- csdn社区的通知功能是怎么做的?
- asp.net2.0中没有.sln和bin文件
var img = <%= Img %>
</script>========
.aspx.cs
定义一个公共的字段或者属性
public string Img = "Hello Js";
typeof(Page),
"script-key",
strScript,
true
);
ScriptManager.RegisterStartupScript(this, this.GetType(), "", "SetText('"+ bianliang + "')", true);function SetText(image)
{
var img;
img = image;
}
如
<script type="text/javascript">
var img = <%= Img %>
</script> ========
.aspx.cs
定义一个公共的字段或者属性
public string Img = "Hello Js";当然也可以输出JS代码Response.Write(" <script>赋值 </script>")也可以
// Page_Load string strScript = "var img='value'; ClientScript.RegisterClientScriptBlock(
typeof(Page),
"script-key",
strScript,
true
);
var focus_height=446
var text_height=18
var swf_height = focus_height+text_height
var pics=<%=img %>'|'
var links='1|2|3|4'
var texts='1|2|3|4'
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="http://sports.qq.com/flash/playswf.swf"><param name=wmode value=transparent><param name="quality" value="high">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="http://sports.qq.com/flash/playswf.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#DADADA" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');
这是那个JS...要怎么改
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>img='value';</script>");
public partial class index : System.Web.UI.Page
{
public string value;
protected void Page_Load(object sender, EventArgs e)
{//在这里给value赋值就可以了
}}解决了就说一声
var img = <%= Img %>
</script> ========
.aspx.cs
定义一个公共的字段或者属性
public string Img = "Hello Js";
var img = " <%= 变量%>";