Iframe是在BODY标签之后动态添加的,它会破坏我的所有网站,所以我想找到刚刚在BODY标签之后的IFrame并使用JQuery删除它.它还添加了一些Js,我也希望删除它.请帮我.
HTML标记
<body>
<iframe></iframe>
<script type="text/javascript">
//<![CDATA[
(function(){
var c = document.body.className;
c = c.replace(/no-js/, 'js');
document.body.className = c;
})();
//]]>
</script>
Run Code Online (Sandbox Code Playgroud) 这不是一个问题,"如何将其传递给函数?" 但是,"这可以接受吗?"
void func( int **ptr );
int main( int argc, char* argv[] )
{
int arr[][3] = {{1, 2,}, {3, 4}, {5, 6}};
int *pArr = *arr;
(&pArr[0])[1] = 3;
func(&pArr);
cin.get();
return 0;
}
void func( int **ptr )
{
cout << "In func()" << endl;
ptr[0][1] = 5;
}
Run Code Online (Sandbox Code Playgroud)
据我所知,这是有效的.它对我来说并不是很安全,但我更喜欢将2D数组传递给函数.而是一个为我工作的指针.
对于那些必须阅读我的代码的人来说,这会非常混乱吗?我应该使用其他方法吗?使用指向数组的指针是一个坏主意吗?
另外,质疑一点偏离主题.我为什么要写:
int arr[] = { 1, 2, 3, 4, 5 };
int *pArr = *arr;
Run Code Online (Sandbox Code Playgroud)
但为什么我不能写
int arr[][3] = {{1, 2,}, {3, 4}, {5, 6}};
int …Run Code Online (Sandbox Code Playgroud) 有没有办法使用CSS控制边框颜色的不透明度/透明度?
我正在尝试创建一个带有页眉和页脚的布局(两者都有固定的高度)和一个填充剩余空间的内容div.在content-div中,我希望div具有基于百分比值的高度(以content-div的heihgt为父级).我无法弄明白该怎么做?
这是我想要完成的一个例子. 布局示例http://img22.imageshack.us/img22/45/layoutbz.png
char *a=NULL;
char *s=NULL;
a=(char *)calloc(1,(sizeof(char)));
s=(char *)calloc(1,(sizeof(char)));
a="DATA";
memcpy(s,a,(strlen(a)));
printf("%s",s);
Run Code Online (Sandbox Code Playgroud)
你能告诉我为什么它打印DATA½½½½½½½■■■??????????????????? 谢谢
我有一个应用程序有一个UINavigationController推进UITabBarController视图.这UITabBarController有四个选项卡,其中一个显示自定义UIViewController,一个实例EventInformationViewController.此自定义视图控制器中的按钮依次将另一个自定义视图控制器推EventRatingAddViewController入视图.此视图控制器中的操作应调用EventInformationViewController实例中的方法.以下代码使应用程序崩溃:
// get the index of the visible VC on the stack
int myIindex = [self.navigationController.viewControllers indexOfObject:self.navigationController.visibleViewController];
// get a reference to the previous VC
EventInformationViewController *prevVC = (EventInformationViewController *)[self.navigationController.viewControllers objectAtIndex:myIindex - 1];
[prevVC performSelector:@selector(rateCurrentEvent:)];
Run Code Online (Sandbox Code Playgroud)
我认为viewControllers属性在导航堆栈上保留了所有VC的数组,因此当前可见的减去索引的索引应指向将当前可见VC推入视图的VC.相反,它似乎指向我UITabBarController:
-[UITabBarController rateCurrentEvent:]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
具体是什么,更重要的是,如何获得指向VC的指针,该指针将当前可见的VC推入视图?
编辑:我最终创建了一个委托协议,EventRatingAddViewController并指定EventInformationViewController为委托.这很好用 - 我仍然认为应该有一种方法来通过导航堆栈访问推送VC.
考虑以下代码(包括jQuery):
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src = "js/jquery-1.4.2.js"></script>
<script type="text/javascript">
jQuery(window).bind("load", function() {
var elem = $("<canvas>", {width:300, height:300});
var canvele = elem[0];
var imm = new Image();
imm.src = "card1/mask-x-6.png";
imm.onload = function(){
var ctx = canvele.getContext('2d');
ctx.drawImage(imm, 0,0);
$('body').append(elem);
}
});
</script>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这将导致图像拉伸,而不是原始宽高比.在Firefox和Chrome上都有.为什么会这样?解决方法?
更新
道歉,如果我不使用jQuery生成canvas元素,这件事就不会发生.我也会把它发布到jQuery论坛.
我有一组字符串.我需要从这个集合中找出满足某些条件的字符串,例如字符串包含A和B或C.这些标准由用户指定,因此它们是动态的.在Linq它应该是这样的,
List<String> items = new List<string> { "sdsdsd", "sdsd", "abc"};
var query = from item in items
where item.Contains("a") && item.Contains("b") || item.Contains("c")
select item;
Run Code Online (Sandbox Code Playgroud)
我想使where条件动态化,以便它可以为用户的任何输入工作.是否可以在C#中执行此操作而不使用任何外部库.也许使用Linq或内置于.Net框架中的其他东西.
谢谢,加里
我想知道我的环境中有什么类型的物体.
我可以证明这样的人是谁:
ls()
Run Code Online (Sandbox Code Playgroud)
但运行类似的东西
sapply(ls(), class)
Run Code Online (Sandbox Code Playgroud)
(显然)不会告诉我们我们所拥有的对象的类型(类)(函数,数字,因子等......)
运用
ls.str()
Run Code Online (Sandbox Code Playgroud)
会告诉我我的对象是什么类,但我不能(例如)要求所有的对象是因子/ data.frame/functions - 等等.
我可以捕获ls.str()的输出,但可能有更聪明的方法 - 任何想法它是什么?
此查询大约需要一分钟才能生成结果:
SELECT MAX(d.docket_id), MAX(cus.docket_id) FROM docket d, Cashup_Sessions cus
Run Code Online (Sandbox Code Playgroud)
然而这一个:
SELECT MAX(d.docket_id) FROM docket d UNION MAX(cus.docket_id) FROM Cashup_Sessions cus
Run Code Online (Sandbox Code Playgroud)
立即给出结果.我看不出第一个人要做的事情会花费更长的时间 - 我的意思是他们只是检查最大的一个数字列表然后返回它们.还有什么可以做我看不到的?
我通过Java在MS Access数据库上使用jet SQL.