call javascript from php code
Posted: Wed May 14, 2008 7:04 am
Hi,
I am new in php programming and I would like your help.
I have made a script that appears and disappears text. This is the javascript :
Also, I have in html a text like this
I would like when something happen to disappear the text.
So, I am trying something as
Unfortunately, it does'nt work.
Could somebody help me?
Thanking you in advance!
P.s.: I try also
with javascript
but nothing!
I am new in php programming and I would like your help.
I have made a script that appears and disappears text. This is the javascript :
Code: Select all
function tog(submenu) {
if (document.getElementById(submenu).style.display == 'none'){
document.getElementById(submenu).style.display = 'block'
} else {
document.getElementById(submenu).style.display = 'none'
}
}Code: Select all
<span class="style1" id="text"> TEXT</span>I would like when something happen to disappear the text.
So, I am trying something as
Code: Select all
<?php
if ($variable==1){
?>
<span class="left" tog('text'); return false;></span>
<?php
}
?>Could somebody help me?
Thanking you in advance!
P.s.: I try also
Code: Select all
<input value="ere" type="submit" id="button1" onClick="toggle('text1','text2','textfield','button1','<?php $variable ?>'); return false"/>Code: Select all
function toggle(a,b,c,d,variable) {
if ((variable=='yes')&&(document.getElementById(a).style.display != 'none'))
{
document.getElementById(a).style.display = 'none'
document.getElementById(b).style.display = 'none'
document.getElementById(c).style.display = 'none'
document.getElementById(d).style.display = 'none'
}
}