Itunes基于Webkit平台,由于安全策略,我们无法在JavaScript中使用跨站点XmlHttpRequest.但是,作为例外,我们可以使用特殊标头来实现.这是源代码,我在Safari中成功完成了它:
var url = 'http://mysite.net/canvas.php';
var mybody = "<?xml version='1.0' charset='utf-8'?><person><name>Arun</name></person>";
var http = new XMLHttpRequest();
http.open("POST", url, true);
http.setRequestHeader("X-PINGOTHER", "pingpong");
http.setRequestHeader('Content-Type', 'application/xml');
http.setRequestHeader("Content-length", mybody.length);
http.setRequestHeader("Connection", "close");
http.send(mybody);
Run Code Online (Sandbox Code Playgroud)
我将xml数据发送到我的服务器并在Safari浏览器中成功获得返回响应,但我无法在iTunes LP环境中执行此操作.那有什么问题呢?
这是我的代码:
var a='(1,2,3,4)'
a=a.slice(-1,1)
alert(a)
Run Code Online (Sandbox Code Playgroud)
我没有打印任何东西.
谢谢
我正在尝试将列的默认日期时间设置为系统日期时间.它显示了一个错误
"InsertionDate"的默认值无效
alter table `vts`.`tblpickpoint`
add column `InsertionDate`
datetime DEFAULT 'Now()' NULL after `PickPointLatLong`
Run Code Online (Sandbox Code Playgroud) 我正在谷歌的Android模拟器上开发一个小应用程序.我试图弄清楚如何模拟从一个仿真器实例到另一个仿真器(都在我的计算机上运行)的电话呼叫.有谁知道如何做到这一点?
非常感谢你.
在我的servlet中,我使用的是Tomcat 5.0,而JRE是1.5.0但是当我点击URL时它会出错.就像我创建一个我的项目的war文件并在tomcat中部署它工作正常.这意味着我的eclipse配置只有问题
错误是: -
Apr 5, 2010 3:20:22 PM org.apache.jasper.compiler.Compiler generateClass
SEVERE: Javac exception
Error starting modern compiler
at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:69)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:942)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) …Run Code Online (Sandbox Code Playgroud) 我的程序中有以下代码:
Thread getUsersist, getChatUsers;
getUsersList = new Thread(this, "getOnlineUsers");
getUsersList.start();
getChatUsers = new Thread(this, "getChatUsers");
getChatUsers.start();
Run Code Online (Sandbox Code Playgroud)
在run()中,我想知道哪个线程正在使用run().如果它的"getOnlineUsers"我会做一些事情,如果它是"getChatUsers"我将做其他事情.那么我怎么知道哪个线程正在使用run()?
我正在编写一个WWW应用程序,它必须在IE下运行.我有在FF下运行的代码的问题,但我不能让它在IE下运行.
// JS代码
function test()
{
if (window.event.keyCode == 13)
window.location.assign("myPage.php");
}
Run Code Online (Sandbox Code Playgroud)
我在window.location和location.href周围尝试了一些类似的方法,也是document.location.我已经读过IE有问题,所以我要求一个解决方案.
目标是,在输入一些文本后重新加载该页面<input type='text' name='item_code' onKeyDown='test()'>,然后单击Enter.因此结果类似于在文本输入下方按提交类型按钮.
在IE中,它重新加载相同的页面,没有任何反应.在FF它正确工作.
更新1:
由bobince给出的尝试解决方案.
<input type='text' name='item_code'>
<script type='text/javascript' >
document.getElementsByName('item_code')[0].onkeydown = function(event)
{
if (event == undefined) { event = window.event; }
if (event.keyCode == 13) { window.location = 'myPage.php'; }
alert('1');
}
</script>";
Run Code Online (Sandbox Code Playgroud)
问题是,如果有alert('1');行,页面显示警报和重定向,如果没有alert('1');行,页面只是重新加载到自身.我不知道这里有什么问题?
更新2:
我正在粘贴最终适合我的东西.
<form action='mainPage.php' method='POST'>
<input type='text' name='item_code'>
</form>
<script type='text/javascript' >
document.getElementsByName('item_code')[0].onkeydown= function(event)
{
if (event == undefined)
{
event = …Run Code Online (Sandbox Code Playgroud) 是否有PHP函数来处理下面的编码?
.replaceAll("\u00c3\u0080", "À")
.replaceAll("\u00c3\u0081", "Á")
.replaceAll("\u00c3\u0082", "Â")
.replaceAll("\u00c3\u0083", "Ã")
.replaceAll("\u00c3\u0084", "Ä")
.replaceAll("\u00c3\u0085", "Å")
.replaceAll("\u00c3\u0086", "Æ")
.replaceAll("\u00c3\u00a0", "à")
.replaceAll("\u00c3\u00a1", "á")
.replaceAll("\u00c3\u00a2", "â")
.replaceAll("\u00c3\u00a3", "ã")
.replaceAll("\u00c3\u00a4", "ä")
.replaceAll("\u00c3\u00a5", "å")
.replaceAll("\u00c3\u00a6", "æ")
.replaceAll("\u00c3\u0087", "Ç")
.replaceAll("\u00c3\u00a7", "ç")
.replaceAll("\u00c3\u0090", "Ð")
.replaceAll("\u00c3\u00b0", "ð")
.replaceAll("\u00c3\u0088", "È")
.replaceAll("\u00c3\u0089", "É")
.replaceAll("\u00c3\u008a", "Ê")
.replaceAll("\u00c3\u008b", "Ë")
.replaceAll("\u00c3\u00a8", "è")
.replaceAll("\u00c3\u00a9", "é")
.replaceAll("\u00c3\u00aa", "ê")
.replaceAll("\u00c3\u00ab", "ë")
.replaceAll("\u00c3\u008c", "Ì")
.replaceAll("\u00c3\u008d", "Í")
.replaceAll("\u00c3\u008e", "Î")
.replaceAll("\u00c3\u008f", "Ï")
.replaceAll("\u00c3\u00ac", "ì")
.replaceAll("\u00c3\u00ad", "í")
.replaceAll("\u00c3\u00ae", "î")
.replaceAll("\u00c3\u00af", "ï")
.replaceAll("\u00c3\u0091", "Ñ")
.replaceAll("\u00c3\u00b1", "ñ")
.replaceAll("\u00c3\u0092", "Ò")
.replaceAll("\u00c3\u0093", "Ó")
.replaceAll("\u00c3\u0094", "Ô")
.replaceAll("\u00c3\u0095", …Run Code Online (Sandbox Code Playgroud)