我需要你的帮助,
出于某种原因,一旦调用 jQuery Prompt 框,我就无法设置“myvar”的值。该文件的代码在这里: http: //pastebin.com/40hD3Q8e
如何修改下面的代码,以便我能够设置提示框文本的 myvar 值。
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
/* Custom dialog styles */
#popup_container.style_1 {
font-family: Georgia, serif;
color: #A4C6E2;
background: #005294;
border-color: #113F66;
}
#popup_container.style_1 #popup_title {
color: #FFF;
font-weight: normal;
text-align: left;
background: #76A5CC;
border: solid 1px #005294;
padding-left: 1em;
}
#popup_container.style_1 #popup_content {
background: none;
}
#popup_container.style_1 #popup_message {
padding-left: 0em;
}
#popup_container.style_1 INPUT[type='button'] {
border: outset 2px #76A5CC;
color: #A4C6E2;
background: #3778AE;
}
</style>
<!-- Core files -->
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.alerts.js" type="text/javascript"></script>
<link href="jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function test(){
var myvar
alert("working")
jPrompt('Type something:', 'Prefilled value', 'Prompt Dialog', function(r) {
//if( r ) { alert('You entered ' + r) }
myvar = r
});
alert(myvar)
}
</script>
</head>
<body>
<input id="alert_button" type="button" value="Show Alert" />
<input id="confirm_button" type="button" value="Show Confirm" />
<input id="prompt_button" type="button" value="Show Prompt" />
<input id="alert_button_with_html" type="button" value="Show Alert" />
<input id="style_1" class="alert_style_example" type="button" value="Style 1" />
<br>
<input type="button" onclick="test()" value="testthis"/>
</body>
</html>