Run <script> in AJAX

This commit is contained in:
Jakub Vrana 2010-11-22 17:40:44 +01:00
parent 6585b23ba8
commit 341290ce12
3 changed files with 10 additions and 4 deletions

View file

@ -157,9 +157,7 @@ foreach ($engines as $engine) {
</table>
<p>
<?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
<script type="text/javascript">
document.write('<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?><\/label>');
</script>
<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?></label>
<?php echo (support("comment") ? checkbox("", "", $comments, lang('Comment'), "columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();") . ' <input id="Comment" name="Comment" value="' . h($row["Comment"]) . '" maxlength="60"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">

View file

@ -236,6 +236,14 @@ function ajaxSend(url, data) {
if (currentState == ajaxState) {
clearTimeout(ajaxTimeout);
setHtml('content', text);
var content = document.getElementById('content');
var scripts = content.getElementsByTagName('script');
var length = scripts.length; // required to avoid infinite loop
for (var i=0; i < length; i++) {
var script = document.createElement('script');
script.text = scripts[i].text;
content.appendChild(script);
}
if (window.jush) {
jush.highlight_tag('code', 0);
}

View file

@ -1,6 +1,6 @@
Adminer 3.2.0-dev:
Get long texts and slow information by AJAX
All operations on select page by AJAX in browsers with support for history.pushState
All links and some forms by AJAX in browsers with support for history.pushState
Adminer 3.1.0 (released 2010-11-16):
TSV export and import