General Community > Scripting Help

javascript with php?

(1/1)

Seph|roth:
ok, i've got this strange question: is it possible to include a file (using PHP), ONLY when a JavaScript statement is returned as true (or whatever, really)?

Like this:


--- Code: ---if (((navigator.appName == "Microsoft Internet Explorer") || (navigator.appName == "Opera") || (navigator.appName == "Netscape2"))
   &&
   (((screen.width == 800) && (screen.height == 600)) || ((screen.width == 1024) && (screen.height == 768)))
      &&
      (navigator.javaEnabled())
         &&
         (flashVer >= flashReq))
         
         document.write("<?php include_once (global.js); ?>",sysCheck)//window.location.replace("index2.php");
         else if ((navigator.appName != "Microsoft Internet Explorer") && (navigator.appName != "Opera")... // etcetera
--- End code ---

when i do this, i get the error
--- Quote ---Parse error: parse error, unexpected T_GLOBAL
--- End quote ---

thanks!

[Unknown]:
You forgot to quote it..

("<?php include_once (global.js); ?>",

Should be...

("<?php include_once ('global.js'); ?>",

-[Unknown]

Navigation

[0] Message Index

Go to full version