~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes, you can send more than one variables to your PHP script residing on the server. Just append the start and end points as request parameters to the query string which you would be using to make an Ajax request. Something like /php/process.php/?start=0&end=10 . Also make sure you encode the URL before making an Ajax request for proper encoding of special characters (like space for instance). And in process.php, you can retrieve the variables from the request object. In J2EE, it would be something like request.getParameter("start") .

Assuming this isn't your first stint with Ajax, you can easily process the response using either the responseText or responseXML attribute of XMLHttpRequest object.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I don't know PHP so I won't be making any erroneous assumptions here but achieving this depends on how you are pulling the data irrespective of the server side language used. Are you pulling the *entire* data in a single request and toggling the SELECT boxes using Javascript or are you fetching the neighborhood data *on demand*.

No matter the approach, it should be pretty easy if you pass the data from PHP to Javscript in JSON format. Here is a pure Javascript implementation which should push you in the right direction.

<!--
    Dynamic drop downs using Javascript
    Copyright (C) 2008  sos aka Sanjay

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Select Example</title>
    <script type="text/javascript">
    function fillSelBox(srcElem, destName) {
      var selOne = srcElem;
      var frm = srcElem.form;
      var selTwo = frm.elements[destName];
      var map = 
      {"fruit": 
        {"default": "- Select …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Surely you must have kept some sort of exception handling / logging in your code to help you pinpoint the error/fault? Also, since the code was previously working, it has surely got something to do with your configuration.

Which type of database driver are you using? Type 1 which uses DSN or Type 4 type pure driver? If Type 1 then you need to create a DSN again on the new machine. Also, checking the error logs of your Application Server / Servlet Container might further clarify the issue.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe this might get you working in the right direction:

<!--
    Calculate the difference between the two dates.
    Copyright (C) 2008  sos aka Sanjay

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Script-Content-Type" content="text/javascript">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Date examples</title>
  <script type="text/javascript">
  // Error checking kept to a minimum for brevity
  
  function setDifference(frm) {
    var dtElem1 = frm.elements['dtTxt1'];
    var dtElem2 = frm.elements['dtTxt2'];
    var resultElem = frm.elements['resultTxt'];
    
    // Return if no such element exists
    if(!dtElem1 || !dtElem2 || !resultElem) {
      return;
    }
    
    //assuming that the delimiter for dt time picker is a '/'.
    var x = dtElem1.value;
    var y = dtElem2.value;
    var arr1 = x.split('/');
    var arr2 = y.split('/');
    
    // If any problem with input exists, return with an error msg
    if(!arr1 || !arr2 || arr1.length != 3 || arr2.length != 3) {
      resultElem.value = "Invalid Input";
      return;
    }

    var dt1 = new Date(); …
Kusno commented: Thanks a lot !!! +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How about showing what you have attempted so far?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe reading the GSVideoBar reference can help you in properly customizing your video bar. As for your problem, you can decrease the size of thumbnails or increase the dimensions of your DIV to get more than 4 videos per strip. For further tweaking please refer the official documentation and in case of queries post in the Google Ajax Search API user group to get a quick response.

Here is a sample snippet:

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>GSvideoBar Sample</title>
  <script src="http://www.google.com/uds/api?file=uds.js&v=1.0"
    type="text/javascript"></script>
  <link href="http://www.google.com/uds/css/gsearch.css" rel="stylesheet"
    type="text/css"/>
  <script src="http://www.google.com/uds/solutions/videobar/gsvideobar.js"
    type="text/javascript"></script>
  <link href="http://www.google.com/uds/solutions/videobar/gsvideobar.css"
    rel="stylesheet" type="text/css"/>

  <style type="text/css">
    body, table, p{
      background-color: white;
      font-family: Arial, sans-serif;
      font-size: 13px;
    }

    td { vertical-align : top; }

    #videoBar {
      width : 100%;
      margin-right: 5px;
      margin-left: 5px;
      padding-top : 4px;
      padding-right : 4px;
      padding-left : 4px;
      padding-bottom : 0px;
    }
  </style>
  <script type="text/javascript">
    function LoadVideoBar() {
      var videoBar;
      var barContainer = document.getElementById("videoBar");

      var options = {
        largeResultSet : true,
        horizontal: true,
        thumbnailSize : GSvideoBar.THUMBNAILS_LARGE,
        autoExecuteList : {
          cycleTime : GSvideoBar.CYCLE_TIME_MEDIUM,
          cycleMode : GSvideoBar.CYCLE_MODE_LINEAR,
          executeList : [ "ytfeed:most_viewed.this_week", "bud light",
                          "ytchannel:fordmodels", "vw gti" ]
        }
      }

      videoBar = new GSvideoBar(barContainer, GSvideoBar.PLAYER_ROOT_FLOATING, options);
    }
    GSearch.setOnLoadCallback(LoadVideoBar);
  </script>
</head>
<body>
    <div id="videoBar">Loading...</div>
</body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

But I am pretty sure everyone here realizes that there is *no* generic solution. How can one go about applying the same set of rules to the C and the Ruby forums? So no, if what we require is a generic solution, parsing the post contents is not the way to go. If specific solutions for each language forums are welcome, then yes, parsing makes it possible though it would still lend to a brittle solution (in braceless languages what would we search for? def? do? while?).

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If I remember correctly, many such alternatives have been suggested previously (like detecting curly braces) but I guess Dani is against any such 'in your face' messages.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

appendChild requires a DOM element, not a string. The Firefox error console would have pointed out the problem much earlier. Other than that, using elem.setXXX / elem.getXXX rather than elem.XXX = YYY might cause failures in some browsers.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Why not just stop worrying about it?

Why? Because it ends up wasting precious time of all the people involved in the process; precious time which could have been otherwise used to help out people.

Leaving those things apart you would be surprised at the number of repeat offenders. I can understand people new to forums getting things wrong on their first attempt but repeating the same mistake after being nicely pointed in the right direction is insanity.

> So just get rid of it all, and we can just go back to yelling at them when they screw up.

Please don't; it feels bad to yell at someone only to be ignored. ;-)

> Heck, I stopped regularly visiting there months ago

I guess the same is the case with Java, or I should say the most active programming sub-forums out there. Why? Because most of them are the ones who end up multi posting their queries in hope of getting an answer from at least one of them.

peter_budo commented: I agree, to go through unformated code is difficult. +10
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You need to take a look at CSS pseudo classes. BTW, this question belongs to the CSS section if this task needs to be achieved only using CSS.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Try using UrlRewriteFilter for serious uses or using a servlet for controller and making appropriate entry in the web.xml file.
With URLRewrite it would be something along the lines of:

<rule>
    <from>^/products/([0-9]+)$</from>
    <to>/products/index.jsp?product_id=$1</to>
    </rule>

For e.g. suppose you have a controller which handles the application flow, the web.xml would look like something:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5">
   
  <description>Testy-web-app</description>
  <display-name>Servlet and JSP Examples</display-name>

  <servlet>
    <servlet-name>Controller</servlet-name>
    <servlet-class>home.projects.testy.servlet.ControllerServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>Controller</servlet-name>
    <url-pattern>/products/*</url-pattern>
  </servlet-mapping>
  
</web-app>

You home page would look something like:

<html>
  <head>
    <title>Product database</title>
  </head>
  <body>
    <div>
      Please choose a product:
      <ul>
        <li><a href="./products/product1">Product 1</a></li>
        <li><a href="./products/product2">Product 2</a></li>
      </ul>
    </div>
  </body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Then it won't work since insertBefore expects both arguments to be DOM element references. It works in IE since in IE the name of the element also contains the element reference. IMO, something like this should work:

var myDiv = document.getElementById("ContactFormDiv");
var myFrm = document.forms["ContactForm"];
myDiv.insertBefore(loadingImg, myFrm);

If it still doesn't work, look at the Error Console of Firefox which serves as a poor man's debugging utility. (Tools -> Error Console)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
> document.getElementById("ContactFormDiv").insertBefore(loadingImg, ContactForm);

Where have you defined ContactForm?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> So much nicer if data would be retrieved from DB in servlet,

Not to mention that actually *nothing* should go in servlet except the processing of request parameters / attributes and invocation of the actual business logic components. This helps in ensuring that you don't repeat yourself when the view changes. E.g. from a web based application to a swing based application.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> It's always the little things that trip one up. Thanks a bunch! :D

You are welcome. Also please make sure you mark the thread as solved if your query is answered by clicking the 'Mark as solved' link.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I've been banging my head against the wall all week on this, and I don't think I have much
> skull left!

Here, I will put you out of your misery. :-)

Anyways, the bug in the program is pretty apparent here given that you make use of global variables in a recursive call. The variable 't' declared in the function AlertArray has global scope given that it is not prefixed with var.Hence, instead of each invocation of the function having its own copy of the counter 't', each function invocation uses the same variable 't' and hence it ends up never being incremented.

TestObj.prototype.AlertArray = function() {
  document.write("<br>TestObj " + this.ID);
  for (var t = 0; t < this.TestArray.length; ++t) {
    this.TestArray[t].AlertArray();
  }
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I really like the idea of pieces not being capable of moving but knowing their legal moves.

I am yet to see a game where the pieces don't move. Each and every piece is capable of moving though the set of legal moves differ from game to game. IMO, the pieces should be capable of moving be always passed a valid position so that they can dumbly and safely move to the position mentioned. Maybe a common interface like Moveable should do the trick here. Also consider abstracting the 'position' concept in your game inside a class which will provide you the flexibility of switching between 1D, 2D and 3D.

Since you are into a client server architecture, you might as well have a Game class whose instance will be a game in progress having attributes like total game time, the game name, the reference to the board in use and the players involved in the game.

There are many other finer points which come to mind but I think the above mentioned ones should get you going.

Alex Edwards commented: Totally approved =) +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> unable to swap images using arrays in javascript

Not surprising considering that the marquee tag is non-standard, deprecated and has no onclick attribute.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The getElementsByName seems to be flawed when working with dynamically added elements in IE. I guess adding elements by using innerHTML is the only way of making IE aware of the existence of new elements.

Anyways, try something simple like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Example</title>
    <script type="text/javascript">
    /**
     *  Dynamically create form elements with incremental names.
     *
     *  @param tableId The ID of the table element.
     *  @param elemName The name of the element to be dynamically created.
     */
    function addRow(tableId, elemName) {
      if(!tableId || !elemName) return;
      
      // Grab hold of a reference to the table element and return from the 
      // function if no table element exists for the given table id.
      var tblElem = document.getElementById(tableId);
      if(!tblElem)  return;
      
      // Insert a new row at the end of the table, a new cell at the start
      // of that row and a new text node to the newly created cell.
      var newRow = tblElem.insertRow(-1);
      var newCell = newRow.insertCell(0);
      var txtElem = document.createElement("INPUT");
      txtElem.name = elemName + "[" + (tblElem.rows.length - 1) + "]";
      newCell.appendChild(txtElem);
    }
    
    function getElementsThatStartWith(frmObj, str) {
      if(!str || !frmObj)  return;
      var elems = frmObj.elements, returnElems = [];
      for(var i = 0, maxI = elems.length; i < maxI; ++i) {
        var elem = elems[i];
        if(elem.name.indexOf(str) == 0) {
          returnElems[returnElems.length] = elem;
        }
      }
      return(returnElems);
    }
    
    function validateHobbies(frmObj) {
      var elems = getElementsThatStartWith(frmObj, "hobby");
      for(var i = 0, maxI = elems.length; i < …
jakesee commented: Very professional programmer +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I doubt the above code would even work in FF2 considering that you explicitly need to pass the event when registering the handler.

<a href="#" onclick="doSomething(event);">
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Above code is working fine on FF but on IE7 name attribute is not set at all.

Just because the 'NAME' attribute is not shown in the alert doesn't mean that it is not set. Try to submit the form and take a look at the submitted query string i.e. the URL, it still submits the newly created form fields. Likewise the code works perfectly fine on the recent version of Opera.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I need to change the names to

hobby[0], hobby[1], hobby[2], hobby[3] ...

so that I can pass POST the values to a PHP script...

Maybe something along the lines of the following snippet. Rigorous error checking omitted for brevity.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Example</title>
    <script type="text/javascript">
    /**
     *  Dynamically create form elements with incremental names.
     *
     *  @param tableId The ID of the table element.
     *  @param elemName The name of the element to be dynamically created.
     */
    function addRow(tableId, elemName) {
      if(!tableId || !elemName) return;
      
      // Grab hold of a reference to the table element and return from the 
      // function if no table element exists for the given table id.
      var tblElem = document.getElementById(tableId);
      if(!tblElem)  return;
      
      // Insert a new row at the end of the table, a new cell at the start
      // of that row and a new text node to the newly created cell.
      var newRow = tblElem.insertRow(-1);
      var newCell = newRow.insertCell(0);
      var txtElem = document.createElement("INPUT");
      txtElem.name = elemName + "[" + (tblElem.rows.length - 1) + "]";
      newCell.appendChild(txtElem);
      
      alert(document.getElementsByTagName("BODY")[0].innerHTML);
    }
    </script>
</head>
<body>
  <form id="frm" name="frm" action="#">
    <table id="tbl">
    <tbody>
      <tr id="dolly">
        <td><input name="hobby[0]"></td>
      </tr>
    </tbody>
    </table>
    <div>
      <input type="button" value="Append" onclick="addRow('tbl', 'hobby');">
      <br>
      <input type="submit">
    </div>
  </form>
</body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> is not standard function avoid to use this.

On the contrary, it is.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Look into HTML DOM classes Table, TableCell and TableRow.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Firefox comes with an excellent debugging utility called Firebug which you can put to your use in this case. Also, the problem might lie in the code which changes the INPUT element to SELECT . How are you making the switch? Are you removing the old element and adding a new one or modifying the existing element? A better way here would be to inspect the state of the web page after show_select() function has been called.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Look into window.open and window.onload for achieving your objective.

mcx76 commented: thanks for help +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
jmasta commented: Solved it! +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> If possible, just some information about the site above would be greatly appreciated.

Finding out what happens behind the scenes is kind of difficult. In your case if quality is of prime importance, generating PDF's out of images is out of the picture. Another option as I mentioned in my previous post is to look for some reporting tool which accepts Autocad files and converts it into native format. But this is more work than it is worth considering that the number of combinations is well known to you.

So IMO, the best option in your case would be to use the VB/Autocad environment to generate the fixed number of PDF's with the file name depending on the input / combination used.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The RegExp you have there is incorrect. The correct one would be:

/*
For Letters: [a-zA-Z] (dealing with both upper and lower case characters)
For Space: [ ]
Putting them together: [a-zA-Z ]+
Use a + instead of * since a blank string is not a valid letter nor a space.
Use ^ and $ since our string should start and end with the given pattern.
*/
var myStr = "hello";
if(/^[a-zA-Z ]+$/.test(myStr) {
  window.alert("String contains only alphabets and spaces");
} else {
  window.alert("String doesn't contain only alphabets and spaces");
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It entirely hinges on what exactly 'generated on fly' means. If it means that depending on each request the format / content of the report might change, then you would be in a big pinch if you statically generate files and keep them on your server. Depending on the number of users / hits, you might easily run out of space!

The important thing here is identifying the lower and upper bounds of the number of reports you can have. If by analyzing the problem domain, you feel that there is as such no upper bound, then you can't use statically generated PDF's as they won't scale to the requirements. AFAIK, PDF files normally use vector fonts so the quality would not have been an issue if it were not for the PNG files used to generate the PDF's (in the end, you are just embedding the image inside PDF). Normally for such things, a Reporting Engine is used (something like Crystal Reports) which can be hooked to a stored procedure to pull out data.

Maybe you should look out for some reporting tool which allows you to import Autocad files so that your task of automatic PDF generation can be simplified to a great extent. Then again, not much can be said without answering the questions posed above or before understanding the exact requirements.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Then create a method in the class that loops the two arrays and checks one by one the
> elements.

Or just use the one provided by the standard library for the Arrays class. If comparing two Object arrays, use the Arrays.deepEquals(Object[] a1, Object[] a2) . When comparing arrays of primitives, use Arrays.equals(primitiveType[] a1, primitiveType[] a2).

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Considering not everyone here uses Windows as their primary operating system; posting a screenshot and the relevant piece of code would help you in getting quick assistance. Also since you mention cutting off the image, it might just come out to be a CSS issue if you are applying some sort of style to the newly opened window / image.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Is javascript the way to go with this?

No, AFAIK it can't be done in Javascript irrespective of whether the PDF's are pre-generated / generated on fly. The way to do it would be process the user input at the server and set the response headers accordingly when the response is thrown out.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

On the surface the code looks error free though I am pretty sure that IE doesn't play well with getAttribute and setAttribute . Just replace them with this.href and this.title (or better yet, just pass this !). If you still are unable to find a solution, there are a few IE Javascript debuggers out there which you can put to good use in your case.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You can loop over all the form elements using the elements attribute of the form or get all the elements under the div and do a selective filtering.

<!--
Author: ~s.o.s~
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv"Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Example</title>
    <script type="text/javascript">
    function showOfForm(frm) {
      if(!frm || !frm.elements) {
        return;
      }
      var elms = frm.elements;
      for(var i = 0, maxI = elms.length; i < maxI; ++i) {
        var elm = elms[i];
        alert("Type: " + elm.type + "\nName: " +
                elm.name + "\nId: " + elm.id);
      }
    }
    function showOfDiv(div) {
      if(!div) {
        return;
      }
      div = typeof div === "string" ? document.getElementById(div) : div;
      var elms = div.getElementsByTagName("*");
      for(var i = 0, maxI = elms.length; i < maxI; ++i) {
        var elm = elms[i];
        switch(elm.type) {
          case "text":
          case "textarea":
          case "button":
          case "reset":
          case "submit":
          case "file":
          case "hidden":
          case "password":
          case "image":
          case "radio":
          case "checkbox":
          case "select-one":
          case "select-multiple":
            alert("Type: " + elm.type + "\nName: " +
                    elm.name + "\nId: " + elm.id);
        }
      }
    }
    </script>
</head>
<body>
  <form id="frm" name="frm" action="#">
    <div id="divOne" style="border: thick solid yellow">
      <input type="text" name="txtOne" id="txtOne"><br>
      <input type="submit" value="Click me" name="btnOne" id="btnOne"><br>
      <input type="radio" name="radGrp1" id="radOne"><br>
      <input type="radio" name="radGrp1" id="radTwo"><br>
    </div>
    <br><br>
    <div id="divTwo" style="border: thick solid red">
      <select name="selOne" id="selOne" multiple="multiple">
        <option value="one">1</option>
        <option value="two">2</option>
        <option value="three">3</option>
      </select>
      <br>
      <input type="checkbox" id="chkOne" name="chkGrp1"><br>
      <input type="checkbox" id="chkTwo" name="chkGrp1"><br>
    </div>
    <br><br>
    <input type="button" onclick="showOfForm(this.form);"
      value="Show form elements" name="btnTwo" id="btnTwo"> …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The error message "Cannot make a static reference to the non-static method" says it all. You need to first instantiate the XYChartExample2 class before invoking its method. BTW, scriptlets are bad and knowing the basics of Java helps before jumping into J2EE.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Since you can manipulate the listener, something like this should be of some use to you:

package home.projects.daniweb;

import java.net.URL;
import java.net.MalformedURLException;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class URLTester {
  public static void main(String args[]) {
    String url = "http://www.google.com/";
    try {
      InputStream in = null;
      try {
        // Open a connection to the resource specified in 'url' and grab hold
        // of the stream.
        URL urlObj = new URL(url);
        in = urlObj.openStream();
        
        // Spit the response to the screen
        BufferedReader bufIn = new BufferedReader(new InputStreamReader(in));
        System.out.println("RESPONSE BEGINS\n");
        String str;
        while((str = bufIn.readLine()) != null) {
          System.out.println(str);
        }
        System.out.println("RESPONSE ENDS\n");
      } finally {
        if(in != null) {
          in.close();
        }
      }
    } catch(Exception e) {
      System.out.println("An exception has occured; " + e.getMessage());
    }
  }
}

If you are relying on a user input and if the action for that is well defined e.g. a user clicking on the logout link, you can code it as a simple HTML page:

<html>
<head>
  <script type="text/javascript">
  // Some script
  </script>
</head>
<body>
  <a href="/setPresence.cfm?user=bob&isOnline=0">Logout</a>
</body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though I am not sure as to what you are trying to achieve, you are getting the mentioned error because the URL constructor (the call new URL() ) throws a checked exception which you need to either catch or make the method have a throws clause.

try {
  URL url = new URL("someURL");
} catch(MalformedURLException mue) {
  // received an invalid url
}

OR

public void doSomething() throws MalformedURLException {
  URL url = new URL("someURL");
}

And BTW, scriptlets are a strict no-no for a variety of reasons. Plus, it would be kind of difficult for you to get into J2EE if your basic Java concepts aren't clear enough.

Nick Evan commented: Good post. (and congrats on you 7th dot;) ) +6
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> should the code for cookie be written in a separate cookie file or should it be written in
> one of the two files that pass and receive data.

The code for cookie management would come in both the HTML documents; in the first one for writing to the cookie and in the second one for reading from the cookie.

> what if i hand over my files to a friends who absolutely has no idea about html but he just
> uses the files to quickly check out some data. If the cookie is deleted, he will do nothing
> but curse me

The cookie creation code would take care of writing the value to the cookie every time the first page is run.

> How will the data be received in the target file ? can it be stored in some variable in a
> target file ?

If by the target file you mean the second HTML document, then yes, you would call a function when the body loads which would read the required data from the cookie written by the first HTML document.

<!-- second html file -->
<html>
<head>
  <script type="text/javascript">
  function readCookie() {
    var valueReadFromCookie = ... // read data from cookie
    var frm = document.forms["frm"];
    var txtBox = frm.elements["txt"];
    txt.value = valueReadFromCookie;
  }
  </script>
</head>
<body onload="readCookie();">
  <form id="frm" name="frm" action="#">
    <span>Value read: </span>
    <input name="txt" id="txt">
  </form>
</body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Since the original request has been solved, create a new thread for questions unrelated to it.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You would need to use cookies for this purpose. When the drop down on your page is selected, you can set the required value in the cookie, navigate to that page and read the value from that cookie when the second page loads to populate the text box.

For more information / code snippets on cookies, visit http://www.quirksmode.org/js/cookies.html

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

A simple script like this should do the job. Do keep it mind that it can be made better in a lot of ways but for your purpose it should serve well enough:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv"Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Expires" content="0"> <!-- disable caching -->
    <title>Example</title>
    <script type="text/javascript">
    function handleAutoAppend(e) {
      // A mapping which maintains a list of what needs to be appended for
      // which key pressed by the user.
      var mappings = {k : "000", m: "000000"};
      
      // Process the event triggered by the user and grab hold of the element
      // on which it was triggered along with the pressed keys' value
      e = e || window.event;
      var code = e.which || e.keyCode;
      var key = String.fromCharCode(code);
      var elem = e.srcElement || e.target;
      
      // For each 'value' of our interest, append the requisite string at the 
      // end of the existing text and return(false) so as not the render 'k'
      // or 'm'
      for(var k in mappings) {
        if(key == k) {
          var val = mappings[k];
          if(elem) {
            elem.value = elem.value + val;
            return(false);
          }
        }
      }
      
      // For all other keys, don't do anything; allow the default behavior 
      // to take over.
      return(true);
    }
    </script>
</head>
<body>
  <form id="frm" name="frm" action="#">
    <p>Enter something:</p>
    <input type="text" name="txt" id="txt" onkeypress="return handleAutoAppend(event);">
  </form>
</body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

A tough question, it's like deciding which of your kids you like the most. ;-)

A few I can think of right now:
• Canvas II
• Shakugan no Shana
• FLCL

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I was so disappointed to read your reply, I thought somebody could illuminate the quirks
> of prototype.js/window.js

I am pretty sure that the quirks of prototype.js can be better explained by the people *at* prototype.js message board; this board is more focussed on general Javascript discussion.

> To me, your example is unnecessarily verbose,

I keep my examples extremely verbose and simple so that beginners don't have a problem understanding them and I had no way of knowing that you had experience with Javascript. I could have added loads of checks but at the cost of confusing the newbies. I am also missing a DOCTYPE but that's a different story altogether...

> In the prototype.js environment you can write document.getElementById('idvalue') as
> $('idvalue') so I'm sure you can understand the simplicity/productivity increase inherent in
> using the libraries.

And what about the people who has just started Javascript? I very well understand the productivity increase / decrease when using Libraries but don't want to drag it all here when there are people people out there struggling with the basics of Javascript.

> you should use ids to shorten the DOM path of elements

I disagree; I would rather pick up ready made references from the 'elements' HTMLCollection than traverse the DOM for a trivial task like getting a reference to a form element...

> I have been writing JavaScript …

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Is there a particular name for this type of comment box?

Yes, it's called a WYSIWYG (What-you-see-is-what-you-get) editor. Here is one which you can use for your site.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Why not just create a normal window? The child window holds a reference to the parent window which created it in the form of 'opener' property. Here 'opener' is the window object of the parent window.

Parent.html

<html>
<head>
	<script>
	function go() {	
		window.open("Child.html");
	}
	</script>
</head>
<body>
<form name="frm">	
	<input type="text" value="Hello" id="txt" name="txt" />
	<input type="button" name="btn" id="btn" value="Button" onclick="go();" />
</form>
</body>
</html>
Child.html

<html>
<head>
	<script>
	function go() {
		alert(opener.document.forms[0].elements["txt"].value);
	}
	function change() {
		opener.document.forms[0].elements["txt"].value = "This is changed text";
    opener.focus();
		this.close();		
	}
	</script>
</head>
<body onload="go();">
	<form>
		<input type="button" value="Change Value in Parent" id="btn" name="btn" onclick="change();"/>
	</form>
</body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The problem statement in itself is kind of confusing; it would be better if you posted a small relevant piece of code which would demonstrate the problem so that others can try to help you out. Also if you are allowed to, you can take help of some external utility libraries out there to do away with the problem of manually handing browser inconsistencies when programming in Javascript.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> i want to develop a code such that when i click on the text next to the radio button the radio
> button should be selected and even if the button is clicked
You don't need Javascript for this; use the HTML label tag.

<p>Try clicking on the text labels:</p>
<form name="input" action="">
<input type="radio" name="sex" id="male" />
<label for="male">Male</label>
<br />
<input type="radio" name="sex" id="female" />
<label for="female">Female</label>
</form>