Help ! keyword for the web - javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lucie

    #1

    Help ! keyword for the web - javascript

    Hi,

    I've created a form with 2 dialoglist fields: 1 state and 1 city.
    I want to select a state, and I need a way to build the city list. In
    order to do this, I've used the onChange event (on the state field)
    and Javascript.

    The script is:
    st = this[this.selectedIn dex].text
    document.all("H idFrame[delete: lookupframe]").src= "/db.nsf
    /CityLookup?Read Form&state=" + ar;

    I want to load the CityLookup page, but it doesn't work.
    Do you know why?

    Thanks, Lucie.
  • Lasse Reichstein Nielsen

    #2
    Re: Help ! keyword for the web - javascript

    lucie.chambrier @parexel.com (Lucie) writes:
    [color=blue]
    > I've created a form with 2 dialoglist fields: 1 state and 1 city.
    > I want to select a state, and I need a way to build the city list. In
    > order to do this, I've used the onChange event (on the state field)
    > and Javascript.
    >
    > The script is:[/color]
    [color=blue]
    > st = this[this.selectedIn dex].text[/color]

    you might mean
    var st = this.options[this.selectedIn dex].text
    You don't use the variable "st" in the following.
    [color=blue]
    > document.all("H idFrame[delete: lookupframe]").src= "/db.nsf[/color]

    document.all is a collection, and is supposed to be used as
    document.all[ ... ], not as a function (although it does work).

    Is the ID of the element really
    "HidFrame[delete: lookupframe]"
    (it is an illegal ID, they can't contain spaces or square brackets).
    [color=blue]
    > /CityLookup?Read Form&state=" + ar;[/color]

    I assume the linebreak is inserted by your news client.
    You use a variable called "ar" that is not declared here.
    Before sending strings as parts of URL's, they should be escaped,
    i.e., change "ar" to "escape(ar) ".
    [color=blue]
    > I want to load the CityLookup page, but it doesn't work.
    > Do you know why?[/color]

    From this code, no. There is far too little information, and
    we can't test it ourselves without the rest of the page.
    You don't even say what happens. "Doesn't work" is not sufficient.

    When asking for help with a program that doesn't work, always include:
    1) What you did (sufficient code to reproduce problem, which browser to use,
    which steps to go through to produce the error).
    2) What you expected to happen (otherwise we can't fix the problem, just
    nod and say "yes, we get the same").
    3) What really happened (in case we can't reproduce the problem).
    There is no such thing as too much detail when you are hunting for bugs.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...