Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 649
  • Last Modified:

I.E. 9.0 vs Firefox 14.1

Could someone tell me why this works in Firefox and not in I.E.?
Either onclick or onchange - the screen comes back exactly like it was before qty is changed in I.E..  I've tested and the input qty is not getting passed to the javascript - it remains the same as it was before it was changed.  I've tried getelementsbyname - it doesn't work either - same exact problem.  

<script type="text/javascript">
function qtychg(ind)
{
  var i = ind;
  var sqty = "qty"+i;
  var qty=document.getElementById(sqty).value;
  var slink = "ordercc.asp?Qty"+i+"="+qty;
  document.forms[0].action=slink;
  document.forms[0].submit();
}
</script>
<%
for i = 0 to 100
      Qtyx = "Qty"&i
if request(Qtyx) <> "" then
      qty=request(Qtyx)
else
      Qty = request.form(Qtyx)
end if
%>
<td   width="50"  align=center bgcolor="<%=bgcolr%>"><font style="font-size:14px;color:#898989;font-family:Arial"><b>
<input type=text id="qty<%=x%>" value="<%=Qty%>" name="qtyx<%=x%>" size=1 onchange="qtychg('<%=x%>')"><img src=images/down.jpg  style=vertical-
align:middle; onclick="qtychg('<%=x%>');" width=12 height=16></b>
</td>
<% next %>
0
dcass
Asked:
dcass
  • 3
  • 2
2 Solutions
 
djon2003Commented:
Could we get the final rendering result ? Or the URL to that page ?
0
 
dcassAuthor Commented:
If you want to test or look at it, sorry - it's behind a log in and a confidentiality agreement.
The question is why does javascript (either getelementbyid or getelementsbyname) only work in Firefox?  
Is it because I'm using a variable for the value of the input field Qty?
That doesn't make sense to me.
Maybe it would help to know I'm just going through a loop for qty0, qty1 ... thru qty100 and of it gets changed, it should be picked up by getelement..., right?  Because it is in Firefox.
Plus the onclick, onchange and onlostfocus all behave the same way in each respective browser.
0
 
djon2003Commented:
Could you post the final HTML rendered ??? Because I would like to see the code without the <% %> tags.. Which, the browser doesn't see ! Replaced by the server.

And you are right, using a variable as the id to get the element should work.
0
 
dcassAuthor Commented:
I'm such a dummy - I had the input field & also had it hidden so it was being treated as an array.   Sorry but thank you very much!
0
 
dcassAuthor Commented:
I found the solution
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now