php image & javascript issue

View: New views
4 Messages — Rating Filter:   Alert me  

php image & javascript issue

by javasac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 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 issue

by javasac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 -->
        <!---->
       
    <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 issue

by Jochem Maas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 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


Parent Message unknown Re: php image & javascript issue

by Wolf-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

---- javasac <javasac@...> wrote:
>
> 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
>
<!-- SNIP -->

You've posted this a NUMBER of times now.

The answers remain the same.

1.  Go to http://htmlgoodies.com and start at the beginning.  LEARN HTML
2.  Go the manual for your webserver and RTFM
3.  Go to W3c and look at relative versus absolute pathing.

You are having the same PEBKAC errors.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php