Jump to content

javascript in php


boumbo

Recommended Posts

hi.  i have a page B which has an image on it. When the page loads i want it to auto click on that image. I wrote the code below but it does not autoclick.  can you please help?

 

 

<script language="javascript">

 

function autoClick() {

    document.getElementById('thisLink').click();

    }

 

</script>

 

<php>

$visitpage =  "http://mywebsitei.com/wp-content/uploads/12345.jpg";

<div style="text-align: center;" ######="setTimeout('autoClick();',3000);">

<a href=<?php echo $visitpage ?> rel="lightbox" >

<img src=<?php echo $visitpage; ?> alt=""/></a>

</div>

</php>

Link to comment
https://forums.phpfreaks.com/topic/261800-javascript-in-php/
Share on other sites

Redirect the page. Your page is in php so use that, not js.

<?php
   header( 'Location: http://mywebsitei.com/wp-content/uploads/12345.jpg' ) ;
?>

And this is all the code you need in the page B.

 

Why you don't just make http://mywebsitei.com/wp-content/uploads/12345.jpg Page B is my question.

Link to comment
https://forums.phpfreaks.com/topic/261800-javascript-in-php/#findComment-1341555
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.