[PHP] How to adpated a javascrip with php...
Hi, I have a Javascript that I like to use with PHP/MYSQL, But I don't know how to mix the two... SCRIPT LANGUAGE = JavaScript bName = navigator.appName; bVer = parseInt(navigator.appVersion); if ((bName == Netscape bVer = 3) || (bName == Microsoft Internet Explorer bVer = 4)) br = n3; else br = n2; if (br == n3) { boardNum = 0; boardSpeed = 4000; billboards = new Array(); billboards[0] = new Image(); billboards[0].src = $x; billboards[1] = new Image(); billboards[1].src = $x; billboards[2] = new Image(); billboards[2].src = $x; billboards[3] = new Image(); billboards[3].src = $x; billboards[4] = new Image(); billboards[4].src = $x; billboards[5] = new Image(); billboards[5].src = $x; billboards[6] = new Image(); billboards[6].src = $x; billboards[7] = new Image(); billboards[7].src = $x; } [I like to make $x to be called from the database...] function rotateBoard() { document.billboard.src = billboards[boardNum].src; if (boardNum billboards.length - 1) { boardNum++; } else { boardNum = 0; } } function jumpBillboard() { window.location.href = url[boardNum]; } /SCRIPT Thanks for any help you can give... Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to adpated a javascrip with php...
I have a Javascript that I like to use with PHP/MYSQL, But I don't know how to mix the two... SCRIPT LANGUAGE = JavaScript bName = navigator.appName; bVer = parseInt(navigator.appVersion); if ((bName == Netscape bVer = 3) || (bName == Microsoft Internet Explorer bVer = 4)) br = n3; else br = n2; if (br == n3) { boardNum = 0; boardSpeed = 4000; billboards = new Array(); billboards[0] = new Image(); billboards[0].src = $x; billboards[1] = new Image(); billboards[1].src = $x; billboards[2] = new Image(); billboards[2].src = $x; billboards[3] = new Image(); billboards[3].src = $x; billboards[4] = new Image(); billboards[4].src = $x; billboards[5] = new Image(); billboards[5].src = $x; billboards[6] = new Image(); billboards[6].src = $x; billboards[7] = new Image(); billboards[7].src = $x; } [I like to make $x to be called from the database...] function rotateBoard() { document.billboard.src = billboards[boardNum].src; if (boardNum billboards.length - 1) { boardNum++; } else { boardNum = 0; } } function jumpBillboard() { window.location.href = url[boardNum]; } /SCRIPT Try something like this billboards = new Array(); ? $cursor = sql query here $i = 0; while ($something from database) { ? billboards[?=$i?] = new Image(); billboards[?=$i?].src = ?=$something?; ? $i++; } ? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to adpated a javascrip with php...
Payne wrote: Hi, I have a Javascript that I like to use with PHP/MYSQL, But I don't know how to mix the two... Here is an example. ?php /* do php stuff here, like set a value to $x */ $x = 3; ? script funtion x() { var foo = ?php echo $x; ?; alert(foo); } /script -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com --- Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php