My javascript button is not firing.
<!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>
Here’s what i am trying. On click of the html button type. fb_publish should fire. This is just my trial.. Not sure if its supposed to work.
In the fb_publish() I have a FB.ui to post the textbox1.text and other event details to FB
try this, add and id to the input tag and use an event trigger once the document has loaded. and put an alert at the beginning of the function to make sure it’s being called.