问题描述
有人可以帮助我从PHP调用Java脚本函数吗?
Can any one help me in calling java script function from PHP
<script>
function HideDiv(id)
{
document.getElementById(id).style.display="block";
}
</script>
if($Acidity=="Acidity")
{
echo"Raj";
echo "<SCRIPT LANGUAGE='javascript'>HideDive('Acidity');</SCRIPT>";
}
我需要使Div可见.
谢谢!
I need to make the Div Visible.
Thanks!
推荐答案
我需要使Div可见.
谢谢!
I need to make the Div Visible.
Thanks!
<script type="text/javascript">
function HideDiv(id)
{
document.getElementById(id).style.display="block";
}
</script>
if(
我在您的代码中发现了两个问题:
1.用于选择脚本语言的脚本标签的属性称为type
并以文本/javascript"作为JavaScript代码.
2.您编写的函数名为HideDiv(id),您称为函数HideDive(id).
希望您能将其与这些更正一起使用!
最好的问候,
曼弗雷德
PS:如果该函数的语义是显示div而不是隐藏div,则应将其称为ShowDiv.
There are two issues I found in your code:
1. Script tag''s attribute to select scripting lanuage is called type
and takes "text/javascript" for javascript code.
2. Function you wrote is named HideDiv(id) you called a function called HideDive(id).
I hope you get it to work with these corrections!
Best Regards,
Manfred
PS: The function should be called ShowDiv if its semantic is to reveal the div and not to hide it.
这篇关于如何从PHP调用Java脚本函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!