Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
处理来自c+的信息时出现问题+;将cgi脚本添加到javascript标记_Javascript_C++_Web Applications_Cgi - Fatal编程技术网

处理来自c+的信息时出现问题+;将cgi脚本添加到javascript标记

处理来自c+的信息时出现问题+;将cgi脚本添加到javascript标记,javascript,c++,web-applications,cgi,Javascript,C++,Web Applications,Cgi,我尝试使用托管在本地IIS(Win7)上的cgi脚本为javascript函数设置变量: cgi: cout在这里似乎很好。当然,您必须从localhost(或其他服务器)运行它 testCgi.html <!DOCTYPE html> <html> <head> <script type="text/javascript" src="/cgi-bin/cgiBinNum.cgi"></script> <script type="

我尝试使用托管在本地IIS(Win7)上的cgi脚本为javascript函数设置变量:

cgi:


cout在这里似乎很好。当然,您必须从localhost(或其他服务器)运行它

testCgi.html

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/cgi-bin/cgiBinNum.cgi"></script>
<script type="text/javascript">
    document.write('The number is: ' + value);
</script>
</head>
<body>
</body>
</html>

document.write('编号为:'+值);
cgiBinNum.cpp

#include <iostream>

using namespace std;

int main()
{
    cout<<"Content-type: text/javascript\r\n\r\n";
    cout<<"var value=2;";
    return 0;
}
#包括
使用名称空间std;
int main()
{

库提特酒店"另一个不应被注释掉。此注释仅适用于已停用javascript的浏览器。这是一个复制和粘贴错误,但无论如何还是要感谢您。另外,您是否打算在/cgi bin/value.exe周围留下开放引号?到目前为止,代码行数如此之少,有两个错误,对此表示抱歉!但我仍然得到相同的结果。这几乎就是为什么至少我有。但现在它应该是这样工作的很好…我编辑我的帖子是为了向您展示我得到的输出,也许您知道它可能来自哪里?我的评论太大了。几分钟后查看我更新的答案。谢谢!这是一个IIS设置。我必须为.exe文件添加一个脚本处理程序,否则它只会返回文件。@Sammy46-不客气。好消息,干杯。:)
MZ�������ÿÿ��¸�������@�����

)��")��4)��F)��\)��p)��z)��)��)��)��¬)��Æ)
��Ø)��)��ô(��Ê(��¼  (��°(��¤(��(��(��(�
(��l(��^(��<(��à(����������@���������È@�û��
������bad allocation��Content-type: text/javascript
���var NumberOfFiles = 2; 

?�������������0���������������� ��H���
X@��V�������<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" 
version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
/assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDING
XXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADD���0�������
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/cgi-bin/cgiBinNum.cgi"></script>
<script type="text/javascript">
    document.write('The number is: ' + value);
</script>
</head>
<body>
</body>
</html>
#include <iostream>

using namespace std;

int main()
{
    cout<<"Content-type: text/javascript\r\n\r\n";
    cout<<"var value=2;";
    return 0;
}
<!DOCTYPE html>
<html><head>

<script type="text/javascript" src="/cgi-bin/cgiBinNum.cgi"></script>
<script type="text/javascript">
document.write('The number is: ' + value);
</script></head><body>The number is: 2




</body></html>