Re: Call Script Dynamically
1. Do not put the script in <div> ...</ div>
A division is made to contain a text or an image, but not to contain a piece of JavaScript, even if not explicitly forbidden.
2. Put the script in the <head> ...</ head>
The normal place for a script in the header of the page.
3. Put the call to a JavaScript function, for example call_js (); in the management of an event.
For example, in the onclick of a button.
Re: Call Script Dynamically
Thank you very much for your reply.
my concerns:
l1) the script returns an image and I must be able to control its position so the launch in the head yes but after the result of this script so the image, or how the position I want is all my worries!
2) this script must be run at the opening of the page so the onclick I can not
Re: Call Script Dynamically
Quote:
but the result of the script appears at the end of my site and not in the div 'test'.
It depends only (in advance) of what the script called. The fact to call anywhere, does not required that will display the "result" where it is ...
Re: Call Script Dynamically
The script returns an image:
if I do:
PHP Code:
<div id='test'><script type='text/javascript' src='http://mysite.com/script.php?value=45147'></script>
</div>
No worries, the image appears in the div, or so I want it to be. Now, if I call the script dynamically (no choice because I have a JavaScript variable in the src), I have in the source
PHP Code:
<div id='test'><script type='text/javascript' src='http://mysite.com/script.php?value=45147'></script>
</div>
but the image appears at the end of my site (just before closing the body)