我有一个网站,我有一个名为share的facebook按钮.我希望当用户点击该按钮时,我的网页内容应该在他的墙上共享.我的代码在我的head标签页面中是这样的:
<script>
function fbs_click(){
u = location.href;
t = document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
Run Code Online (Sandbox Code Playgroud)
我也知道u= url你的内容页面t= title或网站名称,这是在body标签内:
<a rel="nofollow" href="http://www.facebook.com/share.php?u=http://lums.edu.pk/event-detail/lecture-on-citation-management-and-referencing-1133"
class="fb_share_button" onclick="return fbs_click()" target="_blank"
style="text-decoration:none;">Share</a>
Run Code Online (Sandbox Code Playgroud)
你是我想分享的链接.此代码为我打开一个共享页面,并且只分享我的网址而不是我的网页内容.我的内容包括图像,细节和细节(我从数据库表中获取这些值).请有人帮助我.
我是初学者,我有 3 个实体:会员、帖子、评论。一个会员有很多帖子,一个帖子有很多评论。
public class Member
{
[Key]
public int Id{get;set;}
public string Name{get;set;}
public virtual ICollection<Post> Posts { get; set; }
}
public class Post
{
[Key]
public int PostId{get;set;}
public string Subject{get;set;}
public int AccountId{get;set;}
public virtual Member member{get;set;}
public ICollection<Comment> Comments { get; set; }
}
public class Comment
{
[Key]
public int CommentId{get;set;}
public string Body{get;set;}
public int PostId { get; set; }
public virtual Post post { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
这是在我的上下文中定义的关系:
modelBuilder.Entity<Post>()
.HasRequired(c=>c.member)
.WithMany(t=>t.Posts) …Run Code Online (Sandbox Code Playgroud) 这与本主题的其他问题类似,但不同.
我有一个包含记录列表的表,每个记录都有一个选择复选框.
在表格标题中,我有一个"全选"复选框.
当用户选中/取消选中"全选"时,将选择/取消选择记录.这很好用.
但是,当取消选择一个或多个记录时,我需要取消选中"全选"复选框.
我的加价:
<table>
<thead>
<tr>
<th>Name</th>
<th><input type="checkbox" data-bind="checked: SelectAll" /></th>
</tr>
</thead>
<tbody data-bind="foreach: $data.People">
<tr>
<td data-bind="text: Name"></td>
<td class="center"><input type="checkbox" data-bind="checked: Selected" /></td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我的脚本(已编辑):
function MasterViewModel() {
var self = this;
self.People = ko.observableArray();
self.SelectAll = ko.observable(false);
self.SelectAll.subscribe(function (newValue) {
ko.utils.arrayForEach(self.People(), function (person) {
person.Selected(newValue);
});
});
}
my.Person = function (name, selected) {
var self = this;
self.Name = name;
self.Selected = ko.observable(false);
}
Run Code Online (Sandbox Code Playgroud)