Let me preface this by saying that I don't know JavaScript. I've got a page
that is built by a long complicated JavaScript that I was able to hack just
enough to function the way I wanted. There are some lines of code -- those
that define div positioning -- that need to be different depending upon
what it obtained from my database. I could build a simple PHP if/then
statement and embed the entire JavaScript with the lines changed. Or, I
could build a simple PHP if/then statement with only the lines of
JavaScript that need to be changed and embed it within the JavaScript.
which would be better?
JavaScript in PHP
<?php
if (conditional) {
?>
several lines of JavaScript
<?php
}
?>
PHP in JavaScript
<script language="JavaScript">
several lines of JavaScript
<?php
if (conditional) {
echo 'lines of JavaScript';
} else {
echo 'other lines of JavaScript';
}
?>
several lines of JavaScript
</script>
Thanx,
Robb
--
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
----------------------------------------------------
http://www.digitaliguana.com
http://www.cancerreallysucks.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php