Re: Javascript newbie - Please Help



If you do not know why you are using:

1. type="text/javascript"
2. // <![CDATA[
3. // ]]>

...then it is a good indication you should not be using them.


First of all thank you to everybody for the answers received.
As previously specified I don't know javascript, so I don't understand the meaning of <![CDATA[ ......
Any way, seems it is the only way to solve my problem, so I tried the following, just for testing:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>
<title>IP TEST</title>
</head>
<BODY>
</body>
<script type="text/javascript">
alert("Ready to go !!!");
// <![CDATA[
<?php
// User's IP address
print 'var ip1 = ' . $_SERVER['REMOTE_ADDR'] . ';';
// Resolve the IP for the current host
print 'var ip2 = ' . gethostbyname('www.yahoo.com') . ';';
?>
alert("IP Address is "+ip1);
// ]]>
</script>
</html>



But I can't get the alert message with ip1. What is wrong ?

Please note: my browser is Firefox under Linux.

Thank you again.
Stefano
.



Relevant Pages

  • Re: Should UA string spoofing be treated as a trademark violation?
    ... That is not a concrete example, it is a hearsay report ... You imply that I do not use SVG but just making up a problem? ... You don't understand javascript sufficiently well to understand ... When your statements are clear enough to convey meaning the ...
    (comp.lang.javascript)
  • Re: To toggle or not to toggle (was) Thread and subject changing
    ... there is no statement or indication of where it has happened. ... subtopic and which of hir word meaning I am now going to address." ... quotes is a sign that apparently everyone else is not snipping enough. ... That's what the references line is for, ...
    (news.software.readers)
  • Re: How to password protect a web page?
    ... this is JavaScript based meaning that it should only be used for very light security situations. ...
    (microsoft.public.frontpage.programming)
  • Re: java script for "post a comment "
    ... Thomas 'PointedEars' Lahn wrote in ... meaning write everything that comes after ... No offense but I think you need to read up on JavaScript a little ...
    (comp.lang.javascript)
  • Re: a tough question
    ... Javascript has proper ... function objects, meaning you can pass functions around and call them ...
    (comp.lang.javascript)