Javascript not working in Firefox

Discussion in 'Javascript' started by OriginalBrownster, Sep 4, 2006.

  1. Hi there...

    I have a little problem using some javascript in my web app. The app
    seems to work fine in IE but when i use firefox to view it..the
    javascript doesn't seem to work....

    I am using turbogears to make my app..but the layout is mostely html
    and css
    Heres the page thats giving me the troulbe

    <table border="0">
    <dl xmlns:py="http://purl.org/kid/ns#" class="${field_class}"
    id="${field_id}"
    py:attrs="list_attrs">
    <?python x=1 ?>
    <DT py:for="i in xrange(0, len(options))">
    <?python value, desc, attrs = options ?>
    <?python blurb = blurbs ?>
    <tr border="1">

    <td align="left" valign="top">
    <input type="radio" name="${name}"
    id="${field_id}_${value}" value="${value}"

    py:attrs="attrs" />
    </td>

    <td align="left">

    <div id="${x}" class="mborder" style="width:300px;
    height:20px;
    background:#FFFFFF;overflow:hidden;">
    <STRONG>
    <label for="${field_id}_${value}" py:content="desc"
    />
    </STRONG>
    <DD>${blurb}</DD>
    </div>
    </td>

    <td align="left" valign="top">
    <img src="/static/images/arrowd.gif" alt="arrow
    down" title="click to view"
    onclick="showm('${x}','${x}')" id="${x}"/>
    </td>

    </tr>
    <?python x=x+1 ?>
    </DT>
    </dl>
    </table>

    The line thats giving me the trouble is the:
    <img src="/static/images/arrowd.gif" alt="arrow down" title="click to
    view"
    onclick="showm('${x}','${x}')" id="${x}"/>

    that onclick is sending that function to javascript in the head..here
    it is


    <script type="text/javascript">

    var doit = true
    function showm(ob,pict) {
    if(doit) {
    document.getElementById(ob).style.height = '120'

    doit = false
    }
    else {
    document.getElementById(ob).style.height = '20'

    doit = true
    }
    }

    </script>

    I am not totally sure if this is a problem with the javascript or the
    use of css and changing the div size...

    Any suggestions would help
     
    OriginalBrownster, Sep 4, 2006
    #1
    1. Advertising

  2. OriginalBrownster

    web.dev Guest

    OriginalBrownster wrote:
    > <div id="${x}" class="mborder" style="width:300px;
    > height:20px;


    [snip]

    > The line thats giving me the trouble is the:
    > <img src="/static/images/arrowd.gif" alt="arrow down" title="click to
    > view"
    > onclick="showm('${x}','${x}')" id="${x}"/>

    [snip]
    > function showm(ob,pict) {
    > document.getElementById(ob).style.height = '120'


    Your function is being sent the string "${x}", and is thus the id to be
    gotten. However, I don't believe your id is valid.

    >From the W3C:


    url: http://www.w3.org/TR/html4/types.html#type-name

    ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
    followed by any number of letters, digits ([0-9]), hyphens ("-"),
    underscores ("_"), colons (":"), and periods (".").
     
    web.dev, Sep 4, 2006
    #2
    1. Advertising

  3. Even after changing it to an alpha ID it still does not work in firefox

    Thank you for your suggestion
     
    OriginalBrownster, Sep 4, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    1,467
    Adrienne Boswell
    Jan 10, 2007
  2. JB
    Replies:
    3
    Views:
    160
    Fred Oz
    Nov 7, 2004
  3. Replies:
    4
    Views:
    271
    Randy Webb
    Feb 18, 2006
  4. Wiseman
    Replies:
    1
    Views:
    465
    Henry
    Jul 25, 2008
  5. fulio pen
    Replies:
    3
    Views:
    135
    Thomas 'PointedEars' Lahn
    Sep 10, 2008
Loading...

Share This Page