2013-03-22 91 views
0

爲什麼下面的解碼腳本不起作用?原代碼似乎運行得很好。url解碼 - 不起作用

javascript:(function(s){try{s=document.selection.createRange().text}catch(_) {s=document.getSelection()}prompt('State the question and answer below.','Q.' s '')}) 

原代碼:

javascript:%28function%28s%29%7Btry%7Bs=document.selection.createRange%28%29.text%7Dcatch%28_%29%7Bs=document.getSelection%28%29%7Dprompt%28%27State the question and answer below.%27,%27Q.%27+s+%27%27%29%7D%29%28%29 

在此先感謝非常多。

回答

1

它解碼+標誌的空間,嘗試這個辦法:

javascript:(function(s){try{s=document.selection.createRange().text}catch(_) {s=document.getSelection()}prompt('State the question and answer below.','Q.'+s+'')}) 

的區別:改變' s '這個'+s+'

0

不取消轉義的+號,並添加()來結束:

javascript:(function(s){try{s=document.selection.createRange().text}catch(_) {s=document.getSelection()}prompt('State the question and answer below.','Q.' s '')}) 
should be 
javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}prompt('State the question and answer below.','Q.'+s+'')})()