PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > [PHP] php image & javascript issue
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
[PHP] php image & javascript issue

Réponse
 
LinkBack Outils de la discussion
Vieux 08/09/2008, 18h38   #1
javasac
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut [PHP] php image & javascript issue


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.

  Réponse avec citation
Vieux 08/09/2008, 18h41   #2
javasac
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] php image & javascript issue


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.

  Réponse avec citation
Vieux 08/09/2008, 19h47   #3
Jochem Maas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] php image & javascript issue

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');
> }
>
> ==============================================
>
>
>
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h24.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10312 seconds with 11 queries