Bonjour � tous et � toutes
j'ai un p'tit probl�me dans ma fonction js, je suis pas un grand expert du JavaScript, c'est pour cela que je vous sollicite
Impossible de rendre visible mon image lorsque je clique sur mon lien : <a href="javascript:showOne('.$id.')"> .
Ma fonction php
Code PHP : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6 protected function url($string, $id) { if (preg_match("/https?:\/\/[^ ]+?(?:\.png|\.gif|\.jpg|\.jpeg)/", $string)) { return preg_replace('/(https?:\/\/([^ ]*)\/([^ \/]*)\.(png|gif|jpg|jpeg))/Ui', '<a href="javascript:showOne('.$id.')">Afficher l'image</a><img id="myim'.$id.'" class="rounded mx-auto d-block" src="$1" title="" style="visibility: hidden;" />', $string); }
Ma fonction Js
Merci beaucoup pour votre aide.
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10 function showOne(id) { var img1 = document.getElementById("myim" + id); img1.style.visibility = ""; if(img1.style.visibility == "hidden" ) { img1.style.visibility = "visible"; } else { img1.style.visibility = "hidden"; } }
Partager