ANSWERS: 3
-
I finally got the javascript rollover button code to work in a php page. While the buttons wouldn't even display when I used the <?php ... syntax, I decided to not use it all and still saved it as php. So when I called this page from another web php page </php require "";, it did display.
-
You can use PHP to generate text, such as HTML and Javascript. It should not matter if your page is a PHP or HTML in the end it is all plain text. If it is not working with the <?php tags that means your PHP syntax was probally invalid. Try something like HTML and Javascript <img src="pic1.gif" onmouseover="this.src='pic2.gif'" onmouseout="this.src='pic1.gif'" /> PHP and HTML and Javascript: echo '<img src="pic1.gif" onmouseover="this.src='pic2.gif'" onmouseout="this.src='pic1.gif'" />'; Notice how I had to escape the single quote with a backslash.
-
I'm going to explain why it didn't work in php. PHP is run on the server. So You click on submit the page calls another page on the server which the server then runs and spits back the results. The onmouseover code has to be done in javascript which is run on the browser not the server so there's no time delay. This Javascript code can be on a page with a .php file extension or just an .html file expression. The code just needs to be placed in side <script language="javascript"> code </script>
Copyright 2023, Wired Ivy, LLC

by 