输入按钮与onclick Java脚本函数未触发
input button with onclick java script function not firing
我的javascript按钮没有触发。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<div>
<script language="javascript" type="text/javascript">
FB.init({
appId: '185176734893804',
status: true,
cookie: true,
xfbml: true
});
function fb_publish() {
FB.ui(
{
method: 'stream.publish',
message: document.getElementById('<%=TextBox1.ClientID%>').value,
attachment: {
name: 'Friends Gathering',
caption: 'Healthy living',
description: (
'Your welcome to join us on the event'
),
href: 'thomasblog.somee.com'
},
action_links: [
{ text: 'document.getElementById('<%=TextBox1.ClientID%>').value', href: 'thomasblog.somee.com' }
],
user_prompt_message: 'Personal message here'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}
</script>
</div>
<div>
Event Date:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
Event Title:
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Add Event" />
<br />
<br />
<asp:Calendar ID="Calendar1" runat="server" BackColor="White"
<TitleStyle BackColor="White" BorderColor="Black" BorderWidth="2px"
Font-Bold="True" Font-Size="12pt" ForeColor="#333399" />
</asp:Calendar>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<input type="button" onclick="fb_publish()"
value ="Post To facebook Wall" />
</div>
</form>
</body>
</html>
这就是我正在尝试的。点击html按钮类型。Fb_publish应该触发。这只是我的尝试…不确定它是否应该工作。在fb_publish()中,我有一个FB。UI来发布textbox1。文本和其他事件详细信息到FB
试试这个,在输入标记中添加和id,并在文档加载后使用事件触发器。并在函数的开头放置一个警告,以确保它正在被调用。
<script> document.ready( function (){
$('#fb_button').onClick( function(){
alert('button fired');
fb_publish();
}
}
</script>
相关文章:
- 为什么我的控制器没有启动函数.js脚本
- 在Debian中运行包含load()和print()函数的JS脚本
- 无法在java脚本中调用图像的点击事件函数
- AngularJS:如何使用java脚本函数更改跨度的ng-show条件
- 无法将java脚本函数与Panel'绑定;s OnLoad事件
- 从我自己的脚本中包含的Javascript文件中调用一个函数
- 从 java 脚本调用函数时 PHP 中出错
- 如何创建php函数或任何脚本/jquery Javascript,使我能够获取与复选框关联的值并添加它们
- 将javascript函数传递给.php脚本
- 为什么当我需要位于顶部的函数时,在脚本中的某些点上没有定义函数
- 如何将类型和函数传递给JSR-223脚本
- 如何减少数组的脚本中的函数
- Java脚本函数中的PHP(PCRE)验证
- 在HTML JavaScript头部分运行Google脚本函数
- jQuery函数脚本
- JavaScript添加函数脚本 - 有人可以解释一下
- 历史记录 api 状态更改函数脚本在每次发生更改时复制函数调用
- 在.html文件之外执行函数/脚本
- replaceAll函数:脚本太长而无法执行
- 中的回调函数.脚本的移动()