将Javascript插入PHP工作表
Insert Javascript to PHP sheet
你好,我必须为Nextgen Gallery Slider Widget PHP输出之一实现一个jquery任务。至少我意识到,由于我的经历,我被困在了一个荒无人烟的地方。有人能帮我吗
$output .= "'n<script type='"text/javascript'">";
$output .= "'n jQuery(window).load(function() {";
// Shuffle results on random order so even if page is cached the order will be different each time
if($order == 'random' && $shuffle == 'true')
{
$output .= "'n jQuery('div#" . $html_id . "').jj_ngg_shuffle();";
}
$output .= "'n jQuery('div#" . $html_id . "').nivoSlider(";
if(count($javascript_args) > 0)
{
$output .= "{" . implode(",", $javascript_args) . "}";
}
$output .= ");";
if($has_control_nav && $has_thumbs)
{
if($controlnavthumbs == 'nextgen_thumbs' || $controlnavthumbs == 'nextgen_original')
{
$output .= "'n JJNGGUtils.wordpressThumbs('" . $html_id . "', " . ($controlnavthumbs == 'nextgen_thumbs' ? 'true' : 'false') . ");";
}
if($has_center && $thumbsgap != '')
{
$output .= "'n JJNGGUtils.wordpressThumbsCenterFix('" . $html_id . "');";
}
$output .= "'n jQuery('div#" . $html_id . " div.nivo-controlNav').css('visibility', 'visible');";
}
$output .= "'n });";
$output .= "'n</script>'n";
if($shortcode != '1')
{
echo $before_widget . "'n<ul class='"ul_jj_slider'">'n <li class='"li_jj_slider'">" . $output . "'n </li>'n </ul>'n" . $after_widget;
}
else
{
echo $output;
}
}
我想添加
<script type="text/javascript">
jQuery(document).ready(function() {
// hides the slickbox as soon as the DOM is ready
jQuery('#slider').css({visibility: "hidden"});
// toggles the slickbox on clicking the noted link
jQuery('a.nivo-controlNav').click(function() {
jQuery('#slider').css({visibility: "visibile"});
return false;
});
});
</script>
非常感谢您的任何提示和帮助
使用PHP Heredoc功能可以实现您想要的东西,这里有一个关于Heredoc及其用法的简单教程检查一下。您只需要将消息替换为JS代码。你完了。
相关文章:
- PHP Javascript显示/隐藏按钮不工作
- 如何使MailHandler.php在Wordpress中工作
- 如何检查这个代码点火器php函数是否工作,该函数是否在ajax url中使用
- 如何在php中创建一个函数,该函数与文本区域一起工作,通过输入类似[color:red]的内容来打印具有等效颜色的文本
- 如何使Jquery编码的动态下拉菜单与PHP GET变量协调工作
- Foreach无法在php和Jquery中工作
- document.title函数可以't设置它与php一起工作
- 递增 PHP 变量在 JSCRIPT 文档工作方面
- 类似按钮增量计数器不工作.PHP,AJAX,MySQL,javascript
- PHP:运行后变量不工作“;如果“;命令
- 为什么带有php-var的javascript代码不是't工作
- 无法使autocompletion与bootstrap和php代码点火器一起工作
- onClick按钮不工作javascript/php/jquery mobile
- Ajax调用PHP失败,ASP正常工作.NET
- JavaScript函数在php回显中工作吗?
- 使用HTML和任何服务器端语言(PHP,.net,ruby)制作的网站是否可以在每个具有浏览器的设备上工作
- 跨域AJAX不工作PHP
- .单击不工作(PHP)
- Ajax请求不工作php
- Jquery -确认对话框-工作php代码