|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
php image & javascript issueIn my test.php file, I cannot run javascript and images do ot show up. If I run this file using the URL
http://localhost/index/?m=login&name=Sachin I can see 'My name is Sachin'. If I rename this file to test.html and open it, the image shows up and clicking on 'Click Me!' button works fine.
======================================================= <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>SPIDR</title> <script src="javascript/test.js" language="javascript"> </script> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <p><input type="button" name="TEST" onclick="Hello()" value="Click Me!" /></p> <?php $name = $_GET['name']; echo 'My name is ' . $name; ?> </body> </html> ======================================================= test.js function Hello() { alert('Hello Ronaldo'); } ============================================== |
|
|
Re: php image & javascript issueIn my test.php file, I cannot run javascript and images do not show up. If I run this file using the URL
http://localhost/index/?m=login&name=Sachin I can see 'My name is Sachin'. If I rename this file to test.html and open it, the image shows up and clicking on 'Click Me!' button works fine. Pls uncomment the ======================================================= <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>SPIDR</title> <script src="javascript/test.js" language="javascript"> </script> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <!-- pls un comment it to test it --> <!-- <p><input type="button" name="TEST" onclick="Hello()" value="Click Me!" /></p> <?php $name = $_GET['name']; echo 'My name is ' . $name; ?> </body> </html> ======================================================= test.js function Hello() { alert('Hello Ronaldo'); } ============================================== |
|
|
Re: php image & javascript issuejavasac schreef:
> In my test.php file, I cannot run javascript and images do not show up. If I > run this file using the URL > http://localhost/index/?m=login&name=Sachin obviously you need to go a do some learning about: 1. continuously posting the same question over and over on a mailing list 2. URLs, namely the those that are relative and those that are absolute. 3. reading the error log of your webserver when you run http://localhost/index/?m=login&name=Sachin the files you can't see are being requested as follows: http://localhost/index/javascript/test.js http://localhost/index/style.css http://localhost/index/images/login.png and let me guess that those DON'T EXIST. which you would have realised if you bother to look in the webserver logs. > > I can see 'My name is Sachin'. > > If I rename this file to test.html and open it, the image shows up and > clicking on 'Click Me!' button works fine. > Pls uncomment the tag when you run it. > > ======================================================= > > <html> > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=windows-1252"> windows-1252 is not a very helpful charset, some people don't use windows. > <title>SPIDR</title> > <script src="javascript/test.js" language="javascript"> > </script> > <link href="style.css" rel="stylesheet" type="text/css"> > </head> > > <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" > marginheight="0"> > > <!-- pls un comment it to test it --> > <!-- images/login.png --> do you know what an image tag is for? because merely putting a url in a file won't magically turn it into an image. > > <p><input type="button" name="TEST" onclick="Hello()" value="Click Me!" > /></p> > > <?php > $name = $_GET['name']; > echo 'My name is ' . $name; you also need to learn about input validation and output escaping. > ?> > > </body> > </html> > > ======================================================= > > test.js > > function Hello() > { > alert('Hello Ronaldo'); > } > > ============================================== > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |