Dynamic values of javascript accessed from other HTML
<p>I hve  a JSP file which has a text boxes with name param.when i click a button in the JSP form a function of a javascript is called. The values are trapped by the JS function using "document.forms[0].param.value". When i try to display the same value in the JSP by using alert feature the value gets displayed.
              But when i  use a HTML and try accessing the value.i am not able to  retrieve it ,meaning it is empty.But when i use a static value. The value is retrieved. I will enclose the JSP ,JS and HTML file code.Please help me .I worked on this issue for considerable time. </p>

<p>Here is the JSP code </p>

<pre><code>  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org    /TR/html4/loose.dtd"&gt;
   &lt;html&gt;
   &lt;head&gt;
   &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
   &lt;title&gt;Insert title here&lt;/title&gt;
   &lt;script type="text/javascript" language="JavaScript" src="sample.js" &gt; &lt;/script&gt;
    &lt;/head&gt;
   &lt;body&gt;
   &lt;form action="formproc1" name="form1" method = "GET"   &gt;
   &lt;input type=text name = "param" value=""&gt;&lt;/input&gt;
   &lt;center&gt; &lt;input type="submit" value="submit"&gt;&lt;/input&gt; &lt;/center&gt;
   &lt;input type="button" value="click" onclick="justshow()"&gt;&lt;/input&gt;
   &lt;input type="button"  value="click1" onclick="displaystr()"&gt;&lt;/input&gt;
   &lt;/form&gt;


   &lt;/body&gt;
   &lt;/html&gt;
</code></pre>

<p>Here is the javascript file 
                sample.js</p>

<pre><code>  function justshow()
 {
   str=document.forms[0].param.value;
  //document.print("hii");
   str1= str;
   alert(str);
  }
   function displaystr()
   {
str2=str1;
alert(str);

    }

   function display()
   {
     return "answer";
  return str;

   }

      Here is the HTML code which accesses  the sample.js file  


  &lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
   function product(a,b)
   {
    return a*b;
   }
  &lt;/script&gt;
    &lt;script type="text/javascript" src ="C:\Documents and Settings\256160\workspace\simpleapp\WebContent\sample.js"&gt; &lt;/script&gt;
    &lt;/head&gt;

    &lt;body&gt;
      &lt;script type="text/javascript"&gt;
       document.write(product(1,5));
       document.write(display());//this does nt 
    &lt;/script&gt;

   &lt;p&gt;The script in the body section calls a function &lt;/p&gt;

    &lt;/body&gt;
    &lt;/html&gt;
</code></pre>

<p>Finally the question is THE DISPLAY FUNCTION MUST RETURN THE STRING ENTERED IN THE JSP TEXT BOX TO THE HTML .</p>
