Javascript not working in Firefox

  • Thread starter OriginalBrownster
  • Start date
O

OriginalBrownster

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
 
W

web.dev

OriginalBrownster said:
<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 (".").
 
O

OriginalBrownster

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

Thank you for your suggestion
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top