我有一个iframe。它在一个模态中。请参阅以下代码:
Default.aspx
当我使用jquery模式插件打开另一个模态时,iframe的内容丢失了。为什么?我该如何预防?
Jquery代码:
<iframe id="edit-text-modal-value_ifr" src='javascript:""' frameborder="0" allowtransparency="true" title="Rich Text AreaPress ALT-F10 for toolbar. Press ALT-0 for help" style="width: 100%; height: 100px; display: block;">
#document
<!DOCTYPE>
<html>
<head xmlns="http://www.w3.org/1999/xhtml">
<style id="mceDefaultStyles" type="text/css">
.mceResizeHandle {
position: absolute;
border: 1px solid black;
background: #FFF;
width: 5px;
height: 5px;
z-index: 10000
}
.mceResizeHandle:hover {
background: #000
}
img[data-mce-selected] {
outline: 1px solid black
}
img.mceClonedResizable,
table.mceClonedResizable {
position: absolute;
outline: 1px dashed black;
opacity: .5;
z-index: 10000
}
</style>
<base href="http://localhost/drupal-7.34/">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="http://localhost/drupal-7.34/sites/all/libraries/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css">
<link type="text/css" rel="stylesheet" href="http://localhost/drupal-7.34/themes/bartik/css/layout.css">
<link type="text/css" rel="stylesheet" href="http://localhost/drupal-7.34/themes/bartik/css/style.css">
<link type="text/css" rel="stylesheet" href="http://localhost/drupal-7.34/themes/bartik/css/colors.css">
</head>
<body id="tinymce" class="mceContentBody " onload="window.parent.tinyMCE.get('edit-text-modal-value').onLoad.dispatch();" contenteditable="true" spellcheck="false" dir="ltr">
<p>
<br data-mce-bogus="1">
</p>
</body>
</html>
</iframe>
我新的iframe代码:
jQuery('#myid_templates_editor_insertf_field_modal').dialog('open');
答案 0 :(得分:1)
<script type="text/javascript">
$('.the-modal').bind('shown', function() {
tinyMCE.execCommand('mceAddControl', false, 'mce-<?=$reply["id"]?>');
});
$('.the-modal').bind('hide', function() {
tinyMCE.execCommand('mceRemoveControl', false, 'mce-<?=$reply["id"]?>');
});
</script>
这是一个错误,我找到了解决方案here。
答案 1 :(得分:0)
void Main()
{
int numbWrong = 0;
int maxAttempts = 10;
string myWord = "example";
string dashed = "-------";
char[] dashedArray = dashed.ToCharArray();
for (int attempts = 0; attempts < maxAttempts; attempts++)
{
Console.WriteLine("Enter your guess letter using lowercase only.\n");
char input = Console.ReadLine()[0];
if (!myWord.Contains(input))
{
numbWrong++;
continue;
}
for (int i = 0; i < myWord.Length; i++)
{
if (myWord[i] == input)
{
dashedArray[i] = input;
}
}
Console.WriteLine (new string(dashedArray));
if(!dashedArray.Contains('-'))break;
}
Console.WriteLine ("Wrong: {0}", numbWrong);
}
并声明tmp变量gloabaly并在需要时再次使用它。