boumbo Posted April 29, 2012 Share Posted April 29, 2012 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> Quote Link to comment https://forums.phpfreaks.com/topic/261800-javascript-in-php/ Share on other sites More sharing options...
sunfighter Posted April 29, 2012 Share Posted April 29, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/261800-javascript-in-php/#findComment-1341555 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.