是否可以使用CodeIgniter锚点弹出功能使弹出窗口居中?

时间:2010-07-20 15:48:42

标签: javascript codeigniter popup

我知道如何使用javascript集中常规弹出窗口,但我无法使用CodeIgniter的anchor_popup函数。

这是我的代码

$attributes = array(
    'class'     =>  'blue-button',
    'width'     =>  '800',
    'height'    =>  '600',  
    'screenx'   =>  '(window.width - 800) / 2',
    'screeny'   =>  '(window.height - 600) / 2'
);

echo anchor_popup('program/start_worksheet/8', 'Start Worksheet', $attributes);

1 个答案:

答案 0 :(得分:3)

这对我有用:

<?php
$attributes = array(
    'class'     =>  'blue-button',
    'width'     =>  '800',
    'height'    =>  '600',
    'screenx'   =>  '\'+((parseInt(screen.width) - 800)/2)+\'',
    'screeny'   =>  '\'+((parseInt(screen.height) - 600)/2)+\'',
);
echo anchor_popup('program/start_worksheet/8', 'Start Worksheet', $attributes);
?>

编辑:其实我现在正在看这个......这似乎就像在url helper中对这个函数的一点点破解但是因为它的工作原理我认为