Re: PHP and JavaScript
| From: | Niel Archer | Date: | Sat, 12 May 2007 08:17:26 +0000 |
| Subject: | Re: PHP and JavaScript | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-27879@lists.php.net to get a copy of this message | ||
> It works with HTML without body
Technically, both html and body tag pairs are optional, but it make your
page clearer to understand when included.
First thing I'd suggest is NOT using echo. As far as I can see you have
no dynamic content being produced, so put the whole lot before the "<?php"
tag.
If you must use echo then do it like this:
<?php
echo <<<END
<SCRIPT TYPE="TEXT/JAVASCRIPT" LANGUAGE=JAVASCRIPT>
<!-- Hide script from older browsers
function toggleMenu(currMenu) {
if (document.all) {
thisMenu = eval("document.all." + currMenu + ".style")
if (thisMenu.display == "block") {
thisMenu.display = "none"
}
else {
thisMenu.display = "block"
}
return false
}
else {
return true
}
}
// End hiding script -->
</SCRIPT>
<STYLE TYPE="TEXT/CSS">
#menu1 {display:none; margin-left:20px}
</STYLE>
<H3>
<A HREF='page1.html' onClick='return
toggleMenu("menu1")'>Update The Record</A>
</H3>
<SPAN ID='menu1'>
<FORM>
<P>
<TEXTAREA name='hetext' rows='10' cols='40'>
Update the record
</TEXTAREA>
<INPUT type='submit' value='Update'><INPUT
type='reset'>
</P>
</FORM>
</SPAN>
END;
?>
Tested and works on Opera
Niel