Shouldn't this work ? ...

Discussion in 'Javascript' started by Robin, Apr 14, 2004.

  1. Robin

    Robin Guest

    I'm not very good at js, so I'm guessing that I definitely have something
    wrong here ...
    <script language="JavaScript">
    function testFunc(form){
    var tmp1 =[].value;
    document.write tmp1
    .... <form method='post' name='form'>
    <select name="site" onChange="javascript:testFunc(this)">
    <option value='#'>--- (Select Site) ---
    (there is a list here of <option value=".... > that is called
    from a db)

    Anyway, nothing is happening onChange
    Where have I gone wrong?????
    Robin, Apr 14, 2004
    1. Advertisements

  2. Robin

    Hywel Guest

    You don't need the "javascript:" in the onChange event for starters, and
    your document.write statement should be
    document.write (tmpl);
    Hywel, Apr 14, 2004
    1. Advertisements

  3. Robin

    Robin Guest

    thanks. Silly mistake, really.

    Robin, Apr 14, 2004
  4. Robin

    Evertjan. Guest

    Hywel wrote on 14 apr 2004 in comp.lang.javascript:
    And you cannot do a document.write in an onchange without destroying the
    whole page.

    Do an alert(tmp1) or a mydiv.innerHTML = tmp1
    Evertjan., Apr 15, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.