我寻找到一个宁静的设计,想用HTTP方法(POST,GET尽可能多地,...)和HTTP标头.我已经发现了HTTP方法PUT和DELETE不从浏览器的支持.
现在我想要获得相同资源的不同表示,并希望通过更改Accept请求的标头来实现此目的.根据此Accept标头,服务器可以在同一资源上提供不同的视图.
问题是我找不到告诉我的浏览器改变这个标题的方法.
该<a..>标签具有一个类型的属性,可以有一个MIME类型,看起来像一个很好的候选人,但头仍然是浏览器的默认(在Firefox它可以改变在about:config与network.http.accept.default键).
我有一个按钮:
<button id="a" onclick="Foo()">Button A</button>
Run Code Online (Sandbox Code Playgroud)
当我第一次单击此按钮时,我希望它执行Foo(它正确执行):
function Foo() {
document.getElementById("a").onclick = Bar();
}
Run Code Online (Sandbox Code Playgroud)
当我第一次单击按钮时,我想要发生的是将onclick功能更改Foo()为Bar().到目前为止,我只能实现无限循环或根本没有变化.Bar()看起来像这样:
function Bar() {
document.getElementById("a").onclick = Foo();
}
Run Code Online (Sandbox Code Playgroud)
因此,单击此按钮只是交替调用哪个函数.我怎样才能让它发挥作用?或者,什么是显示/隐藏帖子全文的更好方法?它最初开始短路,我提供了一个"查看全文"的按钮.但是当我点击该按钮时,我希望用户能够再次单击该按钮以使文本的长版本消失.
这是完整的代码,如果它有帮助:
function ShowError(id) {
document.getElementById(id).className = document.getElementById(id).className.replace(/\bheight_limited\b/, '');
document.getElementById(id+"Text").className = document.getElementById(id+"Text").className.replace(/\bheight_limited\b/, '');
document.getElementById(id+"Button").innerHTML = "HIDE FULL ERROR";
document.getElementById(id+"Button").onclick = HideError(id);
}
function HideError(id) {
document.getElementById(id).className += " height_limited";
document.getElementById(id+"Text").className += " height_limited";
document.getElementById(id+"Button").innerHTML = "SHOW FULL ERROR";
document.getElementById(id+"Button").onclick = "ShowError(id)";
}
Run Code Online (Sandbox Code Playgroud) 如何通过VBScript验证文件是否conf存在于Program Files下(即C:\ Program Files\conf)?
例如,如果它存在,那么msgBox "File exists"
如果不存在,那么msgbox "File doesn't exist"
FB似乎不尊重发送到/feeds/page.php的ACCEPT标头.见下面的例子:
GET /feeds/page.php?id=10036618151&format=rss20 HTTP/1.1
Connection: Keep-Alive
**Accept: text/xml,application/xml**
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)
Host: www.facebook.com
HTTP/1.1 200 OK
Cache-Control: private, no-cache, no-store, must-revalidate
**Content-type: application/rss+xml**
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Last-Modified: Wed, 08 Feb 2012 10:05:49 -0800
P3P: CP="Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p"
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Set-Cookie: datr=-vIzT4cxw52hjjqTfrpQkNYX; expires=Sat, 08-Feb-2014 16:23:22 GMT;path=/; domain=.facebook.com; httponly
X-FB-Debug: qx/SiyRZDiVPm4wfiKVj37HImPoKM+DVAsO4oKSbSr0=
X-Cnection: close
Date: Thu, 09 Feb 2012 16:23:22 GMT
Content-Length: 41236 …Run Code Online (Sandbox Code Playgroud) 我究竟做错了什么?从我的测试中,objDic.exists永远不会给出错误!
dim objDic
set objDic = createobject("scripting.dictionary")
objDic.add "test","I have not been deleted"
wscript.echo objDic.item("test") 'Displays -- I have not been deleted
objDic.remove "test"
wscript.echo """" & objDic.item("test") & """" 'Displays -- ""
if objDic.exists("test") then wscript.echo """" & objDic.item("test") & """" 'Displays -- ""
Run Code Online (Sandbox Code Playgroud) 这段代码:
@echo off
set /p a=Installing [<nul
set b=1
:loop
if %b% leq 2 set /p a=°<nul
if %b% gtr 4 if %b% leq 6 set /p a=±<nul
if %b% gtr 6 if %b% leq 8 set /p a=²<nul
if %b% gtr 8 if %b% leq 10 set /p a=±<nul
if %b% gtr 10 set /p a=°<nul
choice /t 1 /c y /d y>nul
set /a b=%b%+1
if %b%==13 (echo ]&goto :eof)
goto :loop
Run Code Online (Sandbox Code Playgroud)
...来自http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_1237-DOS-ECHO-text-to-previous-line-by-Paul-Tomasi.html#c18182并生成以下内容cmd窗口中的输出:
Installing [??????????]
Run Code Online (Sandbox Code Playgroud)
但是,我似乎无法通过谷歌找到解释这是如何工作的解释.将其他扩展的ascii字符替换为它们的位置似乎产生"命令的语法不正确",因此只能设法猜测这是一个黑客,通过无意的方式将这些字符交换到扩展的ascii集中的较低字符由设计师的技巧. …
http-headers ×2
vbscript ×2
ascii ×1
batch-file ×1
browser ×1
cmd ×1
dictionary ×1
encoding ×1
exists ×1
facebook ×1
javascript ×1
rest ×1
rss ×1
xml ×1