【发布时间】:2012-02-27 07:18:43
【问题描述】:
我在服务器上的按钮在 alertMsg() 上工作,但在 playSelected() 上却不起作用
我的 Html 按钮适用于 playSelected() 和 alertMsg()
谁能帮我弄清楚为什么?
javascript
function playSelected() {
var a = "Video/" + document.getElementById("TextBox2").value + ".flv";
jwplayer("mediaplayer").setup({
flashplayer: "jwplayer/player.swf",
file: a,
image: "jwplayer/preview.jpg"
});
}
function alertMsg() {
alert("testing123");
}
html 中的按钮
input type="button" runat="server" value="Click me!" onclick='playSelected()'
服务器中的按钮
asp:Button ID="Button2" runat="server" text="call javascript" OnClientClick="playSelected(); return true;" UseSubmitBehaviour="false"
【问题讨论】:
-
如果你使用
Attributes.Add(),你应该使用'onclick'而不是你在aspx标记中使用的'onclientclick'。
标签: c# javascript asp.net