java脚本代码到php代码转换 [英] java script code to php code conversion
本文介绍了java脚本代码到php代码转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< script 类型 = text / javascript >
$( window )。load( function (){
$( a [data-gal ^ ='prettyVideo'])。prettyPhoto({animation_speed:' normal',主题:' facebook',幻灯片显示: false ,autoplay_slideshow: false });
$( a [data-gal ^ ='prettyVideo_1'])。prettyPhoto({animation_speed:' normal',主题:' facebook',幻灯片: false ,autoplay_slideshow: false });
$( a [data-gal ^ ='prettyVideo_2'])。prettyPhoto ({animation_speed:' normal',主题:' facebook',幻灯片显示: false ,autoplay_slideshow:假跨度>});
});
< / script >
$(窗口).load(function(){
<?php
需要 config.php;
$ query = SELECT * FROM videodetails其中album ='。$ _GET [ ' album']。 ' ;
$ result = mysql_query($ query);
$ nume = mysql_num_rows($ result);
$ i = 0;
while ($ row = mysql_fetch_array($ result)){
$ val = prettyVid eo。 $ i ;
$ i = $ i + 1;
?>
$(a [data-gal ^ ='+ < ? php echo($ val); ?> +'])。prettyPhoto({animation_speed:'normal',主题:'facebook' ,幻灯片放映:false,autoplay_slideshow:false});
<? php} ?>
}) ;
< / script >
第二个代码部分的错误是什么?
我需要将第一个代码部分转换为第二部分。
解决方案
( window ).load( function (){
( < span class =code-string> a [data-gal ^ ='prettyVideo'])。prettyPhoto({animation_speed:' normal',主题:' facebook',幻灯片: false ,autoplay_slideshow: false });
( a [data-gal ^ ='prettyVideo_1'])。 prettyPhoto({animation_speed:' normal',主题:' facebook',幻灯片显示: false ,autoplay_slideshow:假跨度>});
<script type="text/javascript">
$(window).load(function(){
$("a[data-gal^='prettyVideo']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
$("a[data-gal^='prettyVideo_1']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
$("a[data-gal^='prettyVideo_2']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
});
</script>
$(window).load(function(){
<?php
require "config.php";
$query = "SELECT * FROM videodetails where album='" . $_GET['album'] . "'";
$result = mysql_query($query);
$nume=mysql_num_rows($result);
$i=0;
while ($row = mysql_fetch_array($result)) {
$val="prettyVideo" . $i;
$i=$i+1;
?>
$("a[data-gal^='"+<?php echo($val); ?>+"']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
<?php } ?>
});
</script>
What is error in second code part?
I need to convert the first code part to second part.
解决方案
(window).load(function(){
("a[data-gal^='prettyVideo']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
("a[data-gal^='prettyVideo_1']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
这篇关于java脚本代码到php代码转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文