TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   Problem with Prototype and PHP (http://www.talkphp.com/javascript-ajax-e4x/2273-problem-prototype-php.html)

wiifanatic 02-18-2008 12:27 AM

Problem with Prototype and PHP
 
Im loading a PHP with prototype that contains JavaScript.
One part is activated when you click a button and the other part is (supposed to) execute when it loads.
The problem is it does not work.
Any way around this?


What the PHP File outputs:
HTML Code:

...
<script type="text/JavaScript">
alert('Test');
</script>
...


SOCK 02-18-2008 12:31 AM

You'll have to provide more detail than that. What's the context of the code snippet you provided? The alert() function is supposed to trigger when the page loads?

Code:

<script type="text/javascript">
window.onload= function() {
  alert('test');
};
</script>


Wildhoney 02-18-2008 12:45 AM

Also, as you're using Prototype then you also have the Event.observe function:

javascript Code:
Event.observe(window, 'load', myFunction, false);

wiifanatic 02-18-2008 01:39 AM

Thank You!


All times are GMT. The time now is 08:04 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0