Can you help me ?
I tried to submit a form (login) on load main page ?
I insert
Code: Select all
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration( onLoad());
Thank you
Moderators: ooffick, General Support Moderators
Post by OlivierFR » Fri Aug 26, 2016 6:42 pm
Code: Select all
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration( onLoad());
Post by Alejo » Sat Aug 27, 2016 2:41 pm
Code: Select all
function getJavaScript($message) {
$javascript .= 'if(window.addEventListener){ // Mozilla, Netscape, Firefox' . "\n";
$javascript .= ' window.addEventListener("load", function(){ alert("' . $message . '");}, false);' . "\n";
$javascript .= '} else { // IE' . "\n";
$javascript .= ' window.attachEvent("onload", function(){ alert("' . $message . '");});' . "\n";
$javascript .= '}';
return $javascript;
}
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration( getJavaScript( 'This will appear in an alert box after the page loads.' ) );
Post by OlivierFR » Sun Aug 28, 2016 6:45 am
Code: Select all
<?php
function Submit() {
$javascript .= 'if(window.addEventListener){ // Mozilla, Netscape, Firefox' . "\n";
$javascript .= ' window.addEventListener("load", function(){ document.getElementById("login-form").submit();}, false);' . "\n";
$javascript .= '} else { // IE' . "\n";
$javascript .= ' window.attachEvent("onload", function(){ document.getElementById("login-form").submit();});' . "\n";
$javascript .= '}';
return $javascript;
}
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration( Submit() );
?>
Return to “Joomla! 3.x Coding”
© 2005 - 2024 Open Source Matters, Inc. All Rights Reserved.