echo "";
?>
JS function:
function Show_div () {
document.getElementById ("Show"). style.display= "Block";
}
Div is hidden, want to use PHP call JS function to display the DIV
Reply to discussion (solution)
Call of course no problem, you need to note that the code of the JS function must be output before echo. And your id=show div is going to be output before the JS code.
Div->js->php Echo Jscode.
Can the order of PHP->DIV->JS be implemented? If I put PHP at the end of the other features will have an impact ...
PHP output Call JS when the div and JS code does not exist how it executes?
That doesn't mean you're directly on the page.
What do you think it's going to do?
Why do I use echo "";
Can the div be displayed?
Directly with echo "";
When they're not, what's the difference?
Page execution is from top to bottom: You can put the DIV and JS functions on the PHP page.
SetTimeout (' Show_div () ', 10)
The Show_div () function is called after 10 millisecond seconds. This is when the DOM is loaded.
Sorry, it's a typo.
You can put the DIV and JS functions on the PHP page.
= = "
You can put the DIV and JS functions on top of the PHP code.
Page execution is from top to bottom: You can put the DIV and JS functions on the PHP page.
SetTimeout (' Show_div () ', 10)
The Show_div () function is called after 10 millisecond seconds. This is when the DOM is loaded.
Show ();
Function Show ()
{
echo ' Hello word! ';
}
?>
What's the explanation for this?
We are talking about Div and JS in php output execution, not to discuss PHP functions, please see clearly.
According to your logic, you can write JS directly in PHP.
Reference 5 Floor jordan102 's reply:
Page execution is from top to bottom: You can put the DIV and JS functions on the PHP page.
SetTimeout (' Show_div () ', 10)
The Show_div () function is called after 10 millisecond seconds. This is when the DOM is loaded.
Show ();
Function Show ()
{
echo ' Hello word! ';
}
?......
Explain what? This is PHP, upstairs is js/html.
Reference 5 Floor jordan102 's reply:
Page execution is from top to bottom: You can put the DIV and JS functions on the PHP page.
SetTimeout (' Show_div () ', 10)
The Show_div () function is called after 10 millisecond seconds. This is when the DOM is loaded.
Show ();
Function Show ()
{
echo ' Hello word! ';
}
?......
It is estimated that your echo was output before JS. At that time, the Show_div function was not executed. • • You delay 10 seconds, the page is loaded, and the JS function naturally has
You put echo at the end of the file.
Thank you, you've figured it out.
May I ask how you solved it?