Bob Bedford wrote:
Hi both,
Thanks for your answers.
Use onLoad event instead.
<body onLoad='document.forms["RedirectLogin"].submit()';">
The code is generated by a PHP script that "redirect" only on some cases.
It's quite a long work to change things. It's there an other way ?
Bob
How is it "long work" to include the onload event dynamically?
<?php
if (whateverYourConditionIs) {
print "<body onload=\"document.forms['RedirectLogin'].submit();\">";
} else {
print "<body>";
}
?>
or
<?php
print "<body" .
(whateverYourConditionIs ? "
onload=\"document.forms['RedirectLogin'].submit();\"" : "") .
" style=\"margin:1em;\"" .
">";
?>
or
<body>
<!-- content -->
<?php
if (whateverYourConditionIs) {
print "<script type=\"text/javascript\">";
print "window.onload = function() {";
print "document.forms['RedirectLogin'].submit();";
print "}";
print "</script>";
}
?>
</body>
I probably missed several hundred other ways of accomplishing what you want
using PHP. This is what PHP (or any other server-side technology) is for, to
_dynamically_ create content based on certain logic, conditions or data. The
fact that the content PHP is generating is client-side JavaScript is
irrelevant to PHP.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq