2014-03-13 42 views

回答

2

您可以使用JavaScript:

HTML

<input id="answer" type="text" /><input id="go" type="button" value="answer" /> 

JS:

document.querySelector('#go').addEventListener('click', function(){ 
var answer = document.querySelector('#answer').value; 
var title = "troll mode"; 
var imagePath = "http://i.imgur.com/kTUYF.jpg" 
if(answer === "" || answer !== "right answer"){ 
    var win=window.open('','win','resizable=yes,scrollbars=no'); 
    win.document.write('<html><head><title>' + title + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no"><img src="' + imagePath + '"/>'); 
}}); 

測試:http://jsfiddle.net/5RdWW/2/

相關問題