我无法弄明白。
index.php脚本(100%工作):
function openBlockEditor(block, nick) {
var blockInfo = $.ajax({
url: "Element/BlockEditor.php",
type: "GET",
data: 'block=' + block + '&nick=' + nick,
dataType: "html"
});
blockInfo.done(function(msg) {
$("#dialog-modal").html(msg).dialog(
{
show: {
duration: 100
},
hide: {
duration: 100
}
});
$('.ui-dialog-title').html("Block editor")
});
blockInfo.fail(function(jqXHR, textStatus) {
alert( "Please report this: " + textStatus );
});
}
元素/ BlockEditor.php:(此页面包含模态窗口内容)
Test:<div id="BuildedBox"></div>
<?php
if($MACHINE_digger==1){$MACHINE_digger="<a href=\"#\" onclick=\"buttonBuild('$block_id', 'Pomp', '$nick')\">[BUILD]</a>";}else{$MACHINE_digger="<strike>[BUILD]</strike>";}
if($MACHINE_waterpomp==1){$MACHINE_waterpomp="<a href=\"#\" onclick=\"buttonBuild('$block_id', 'Pomp', '$nick')\">[BUILD]</a>";}else{$MACHINE_waterpomp="<strike>[BUILD]</strike>";}
?>
Digger:<?php echo $MACHINE_digger; ?><br/>
WaterPomp:<?php echo $MACHINE_waterpomp; ?><br/>
<a class="ub" id="BlockEditorSaveButon" href="#">Refresh</a>
<script>
$(function() {
$("#BlockEditorSaveButon").click(function() {
$("#show_planet_realtime").load("../in/GameEngine/RealTimeRender.php?p=<?php echo $nick; ?>")
})
})
function buttonBuild(id, building, nick)
{
$("#BuildedBox").load("BlockEditor/build.php",{
id:id,
building:building,
nick:nick
});
}
</script>
在此页面中,我的buttonBuild()
功能无效。我还尝试将其放在函数openBlockEditor()
下面的 index.php 中,但无法正常工作..是否有可能将buttonBuild()
与openBlockEditor()
联系起来? ??函数openBlockEditor()
调用一个带有信息的模态窗口,函数buttonBuild()
必须在该模态窗口内执行.load()
操作。