|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
In 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 http://www.nabble.com/file/p19376008/login.png 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"> login.png <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'); } ============================================== -- View this message in context: http://www.nabble.com/php-image---ja...p19376008.html Sent from the PHP - General mailing list archive at Nabble.com. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 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"> <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 --> <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'); } ============================================== -- View this message in context: http://www.nabble.com/php-image---ja...p19376099.html Sent from the PHP - General mailing list archive at Nabble.com. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
javasac 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 ful 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'); > } > > ============================================== > > > > |
|
![]() |
| Outils de la discussion | |
|
|