问题列表 - 第47975页

什么是[对象窗口]?

谷歌翻译,有一些书签允许翻译,点击一下,例如:

javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/?text='+t+'&hl=en&langpair=auto|en&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&hl=en&langpair=auto|en&tbb=1&ie='+e;};
Run Code Online (Sandbox Code Playgroud)

这个javascript代码打开当前页面中的翻译页面(target = _self),但是我希望它打开一个新窗口(tab)进行翻译.所以改为:

javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){window.open('http://translate.google.com/?text='+t+'&hl=en&langpair=auto|en&tbb=1&ie='+e);}else{window.open('http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&hl=en&langpair=auto|en&tbb=1&ie='+e);};
Run Code Online (Sandbox Code Playgroud)

我的问题在于:当我运行该代码时,它会为翻译打开一个新窗口,然后执行此操作; 但非英文页面内容被替换[object Window],但我不想改变原始页面内容......

我能做什么?

谢谢 ..

javascript

4
推荐指数
1
解决办法
9743
查看次数

寻找最快的方法来排序2000个项目的列表,其中包含三个不同的C++值

基本上,程序将被给予一个项目列表,它们必须被分成三个不同的"箱子".把它想象成你正在整理三种颜色的大理石.这些项都是char类型.谢谢您的帮助.

c++ sorting algorithm optimization

1
推荐指数
1
解决办法
420
查看次数

问题包括jsonCpp标头

我正在尝试在我的C++代码中实现jsoncpp库,我编写了一段简单的代码来试试它,它甚至都没有编译.

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>

#ifndef json_included
#define json_included
#include "jsoncpp\include\json\json.h"
#endif

//#include "json\jsonC\json.h"
int main(int argc, char **argv)
{

std::string example = "{\"array\":[\"item1\", \"item2\"], \"not an array\":\"asdf\"}";
Json::Value value;
Json::Reader reader;

bool parsed = reader.parse(example, value, false);
std::cout << parsed;
return 0;
}
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

undefined reference to `Json::Reader::parse(std::string const&, Json::Value&, bool)'
undefined reference to `Json::Reader::Reader()'
undefined reference to `Json::Value::~Value()'
undefined reference to `Json::Value::Value(Json::ValueType)'
Run Code Online (Sandbox Code Playgroud)

我对C++有点新意,在include语句中有什么我想念的吗?或者jsonCpp需要额外的东西吗?

感谢您的时间!

c++ compiler-errors header include jsoncpp

3
推荐指数
1
解决办法
2万
查看次数

下载Cocoa API文档

是否可以下载所有Cocoa API文档?我必须离线工作很多次,有时怀疑会阻止我的所有工作......

macos xcode cocoa

9
推荐指数
1
解决办法
5974
查看次数

10
推荐指数
1
解决办法
6374
查看次数

为什么在我的jQuery中使用下一个'div'不起作用?

我有以下jQuery 确实找到了ASP.NET服务器控件(通过在块中放置一个alert()进行测试),但它没有使用.next()在DOM中的下一个DIV上设置高度.但是,如果我使用直接JS做同样的事情,直接通过ID调用DIV它工作正常.

我想要做的是不使用DIV的硬编码ID以防它改变,而是走DOM以动态地获取元素并设置高度.

所以第一:我试图操纵的HTML源代码:

<div id="WebViewer" style="height:100%;width:100%;margin-right: 0px">
   <input name="WebViewerReportReceipt" type="hidden"/>
   <input name="WebViewerViewerType" type="hidden"/>
   <DIV id="WebViewer_controlDiv">
    <iframe src="295769102_1619997395_16141400_2120403583/CacheItem" style="width:100%;height:100%;"></iframe>
   </DIV>
</div>
Run Code Online (Sandbox Code Playgroud)

接下来我认为应该工作的非工作jQuery :

//Using the 'DIV' that is created by the viewer (at runtime), resize it dynamically to fit the window
    var myHeight = $(window).height();
    if ($('#<%=WebViewer.ClientID %>') != null) {                
          $('#<%=WebViewer.ClientID %>').next('div').height(myHeight - 10);
    }
Run Code Online (Sandbox Code Playgroud)

最后一点是,JS 的工作,但我宁愿不被硬编码ID访问DIV和使用jQuery来代替:

var myHeight = $(window).height();
//Using the 'DIV' that is created by the viewer (at runtime), resize it dynamically …
Run Code Online (Sandbox Code Playgroud)

asp.net jquery

1
推荐指数
1
解决办法
315
查看次数

TabContiner用剃刀

我有个问题.是否可以在剃刀视图中使用AJAX Control Toolkit?我需要使用TabContainer或类似的(它可能是一个HTML Helper)

我知道我可以在aspx中使用它,但我在我的项目中使用Layouts ...所以也许部分视图是解决方案,我真的不知道.

问候.

razor asp.net-mvc-3

0
推荐指数
1
解决办法
3566
查看次数

在VBA中检查哪个Excel工作表处于活动状态(当前显示)

我正在寻找一种方法来检查Excel工作表当前是否处于活动状态(当前显示).我对同步方法感兴趣,而不是在事件中.

excel vba excel-vba

10
推荐指数
1
解决办法
6万
查看次数

如何在运行时设置水晶报表的文本框值?

如何在运行时设置crystal report的文本框值.我在crystal report中的section2(页眉)中有一个文本框,现在我必须在运行时设置此文本框的Text属性.基本上我必须在此文本框中传递用户名.

asp.net crystal-reports visual-studio

6
推荐指数
1
解决办法
1万
查看次数

通过对象的属性对对象的矢量进行排序

我正在为学校做一个项目,需要对一些数据进行排序.我已经获得了一个对象向量,我必须根据它们的一个属性对对象(就地或使用索引)进行排序.有几个不同的对象和几个不同的属性可以按其排序.这样做的最佳方法是什么?

c++ sorting std

10
推荐指数
3
解决办法
8731
查看次数