求一个字符串语句的写法
来源:百度知道 编辑:UC知道 时间:2024/07/04 13:30:58
在VB.NET中,有这样一个字符串语句:
ani += " <ScriptAction AnimationTarget='TextBox2' Duration='.5' script=""$get('TextBox2').style.backgroundColor ='red';"" />"
这个在C#中这样写是绝对错的,出现script=""$get('TextBox2'),看不懂它是什么意思,我想请问,如何把它转换成C#的等效写法,急求中。
ani += " <ScriptAction AnimationTarget='TextBox2' Duration='.5' script=""$get('TextBox2').style.backgroundColor ='red';"" />"
这个在C#中这样写是绝对错的,出现script=""$get('TextBox2'),看不懂它是什么意思,我想请问,如何把它转换成C#的等效写法,急求中。
$get这个应该是一个封装好的JS方法,是用来通过ID获取表单元素的方法
应该是这样写的
function &get(string ObjID)
{
return document.getElementById(ObjID);
}
所以这一句
script=\"$get('TextBox2').style.backgroundColor ='red';\" />"完整的写应该是:
script=\"document.getElementById('TextBox2').style.backgroundColor ='red';\" />"
ani += " <ScriptAction AnimationTarget='TextBox2' Duration='.5' script=\"$get('TextBox2').style.backgroundColor ='red';\" />"
用转意啊!
\$或者 你在字符串前面加上 @ 例如:
string str = @ "$get"