473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

this does't work in firefox

11
hi
i m working in asp classic. The below code works in internet explorere but does't work in firefox. pleas help me

Expand|Select|Wrap|Line Numbers
  1. function DisplayMe(e)
  2. {
  3. //document.getElementById("CompName").value == 
  4. //alert(e.id);
  5. var elTableRow = document.getElementById(e.id);
  6. var elTableCells = elTableRow.getElementsByTagName("td");
  7.  
  8. if (document.all) {
  9. document.getElementById("CompName").value=elTableCells[1].innerText;
  10. //var cell = elTableRow.getElementsByTagName("td")[1];
  11. //var content = elTableCells[1].innerText;
  12. //document.getElementById("CompName").value=elTableCells[1]
  13.  
  14. document.getElementById("City").value=elTableCells[2].innerText;
  15. document.getElementById("Country").value=elTableCells[3].innerText;
  16. document.getElementById("Email").value=elTableCells[4].innerText;
  17. document.getElementById("Phone").value=elTableCells[5].innerText;
  18. document.getElementById("CompanyURL").value=elTableCells[6].innerText;
  19. document.getElementById("compDesc").value=elTableCells[7].innerText;
  20. document.getElementById("ID").value=elTableCells[1].id;
  21. //alert(elTableCells[2].innerText);
  22.  
  23. }
  24. else
  25.  
  26. {
  27. document.getElementById("CompName").textContent=elTableCells[1].textContent;
  28. document.getElementById("City").value=elTableCells[2].textContent;
  29. document.getElementById("Country").value=elTableCells[3].textContent;
  30. document.getElementById("Email").value=elTableCells[4].textContent;
  31. document.getElementById("Phone").value=elTableCells[5].textContent;
  32. document.getElementById("CompanyURL").value=elTableCells[6].textContent;
  33. document.getElementById("compDesc").value=elTableCells[7].textContent;
  34. document.getElementById("ID").value=elTableCells[1].id;
  35.  
  36. alert(document.getElementById(e.id).textContent);
  37. }
  38. document.getElementById("CompName").textContent=elTableCells[1].textContent;
  39.  
  40. }
  41. //--></script><!--webbot BOT="GeneratedScript" endspan -->
May 10 '10 #1
5 2072
Dormilich
8,658 Expert Mod 8TB
any messages in the Error Console?
May 10 '10 #2
Plater
7,872 Expert 4TB
I don't see any checking to ensure getElementById() actually returns something.

You should also get errors in IE since you have a .textContent line outside of the else {} block. According to this: http://xn--www-5da33as14n.w3schools....om_element.asp IE doesn't support textContent
May 10 '10 #3
gm000
11
@Dormilich
there is no error wroking well but not onlclick event work in firefox.

here is complelte code of my page.suggest me solution for firefox

Expand|Select|Wrap|Line Numbers
  1. <% if not session("username") = "OK" then response.redirect "../login.asp" %>
  2. <!--#include virtual="admin/cnn.asp" -->
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Language" content="en-us">
  6. <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
  7. <meta name="ProgId" content="FrontPage.Editor.Document">
  8. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  9. <title>STOCK STATUS REPORT</title>
  10. </head>
  11.  
  12. <body>
  13.  
  14. <p align="center"><font face="Arial Black" size="2">VENDOR MANAGEMENT</font></p>
  15. <!--webbot BOT="GeneratedScript" PREVIEW=" " startspan -->
  16. <script Language="JavaScript" Type="text/javascript"><!--
  17. function FrontPage_Form1_Validator(theForm)
  18. {
  19.  
  20.   if (theForm.CompName.value == "")
  21.   {
  22.     alert("Please enter a value for the \"Title\" field.");
  23.     theForm.CompName.focus();
  24.     return (false);
  25.   }
  26.  
  27.  
  28.   return (true);
  29. }
  30.  
  31. function DisplayMe(e)
  32. {
  33. //document.getElementById("CompName").value == 
  34. //alert(e.id);
  35. var elTableRow = document.getElementById(e.id);
  36. var elTableCells = elTableRow.getElementsByTagName("td");
  37.  
  38. if (document.all) {
  39. document.getElementById("CompName").value=elTableCells[1].innerText;
  40. //var cell = elTableRow.getElementsByTagName("td")[1];
  41. //var content = elTableCells[1].innerText;
  42. //document.getElementById("CompName").value=elTableCells[1]
  43.  
  44. document.getElementById("City").value=elTableCells[2].innerText;
  45. document.getElementById("Country").value=elTableCells[3].innerText;
  46. document.getElementById("Email").value=elTableCells[4].innerText;
  47. document.getElementById("Phone").value=elTableCells[5].innerText;
  48. document.getElementById("CompanyURL").value=elTableCells[6].innerText;
  49. document.getElementById("compDesc").value=elTableCells[7].innerText;
  50. document.getElementById("ID").value=elTableCells[1].id;
  51. //alert(elTableCells[2].innerText);
  52.  
  53. }
  54. else
  55.  
  56. {
  57. document.getElementById("CompName").textContent=elTableCells[1].textContent;
  58. document.getElementById("City").value=elTableCells[2].textContent;
  59. document.getElementById("Country").value=elTableCells[3].textContent;
  60. document.getElementById("Email").value=elTableCells[4].textContent;
  61. document.getElementById("Phone").value=elTableCells[5].textContent;
  62. document.getElementById("CompanyURL").value=elTableCells[6].textContent;
  63. document.getElementById("compDesc").value=elTableCells[7].textContent;
  64. document.getElementById("ID").value=elTableCells[1].id;
  65.  
  66. alert(document.getElementById(e.id).textContent);
  67. }
  68. document.getElementById("CompName").textContent=elTableCells[1].textContent;
  69.  
  70. }
  71. //--></script><!--webbot BOT="GeneratedScript" endspan -->
  72.  
  73. <form method="POST" action="VendorMgt_2.asp" onSubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">
  74.   <div align="center">
  75.     <center>
  76.  
  77.  
  78.         <table width="630" border="0" cellpadding="3" cellspacing="2" bordercolor="#111111"  ID="Table12" style="border-collapse: collapse">
  79.             <tbody>
  80.  
  81.               <tr> 
  82.                 <td class=blueBold colspan="4" height="15%" align="left" bgcolor="#DFEAFD">
  83.                    <font face="Verdana, Arial, Helvetica, sans-serif" size="1">  <b> VENDOR INFORMATION: <b></font>
  84.                </td>
  85.                </tr>
  86.  
  87.  
  88.                  <tr> 
  89.                 <td class=blueBold width="10%" height="15%" align="left">
  90.                       <font face="Verdana, Arial, Helvetica, sans-serif" size="1">Title  :
  91.                </td>
  92.                 <td class=blueBold width="40%" height="85%"> 
  93.                     <font face="Verdana, Arial, Helvetica, sans-serif" size="1">
  94.                   &nbsp;<input name="CompName" size="25" maxlength="50" value="<%=compName%>"  class="box">
  95.                   </font>
  96.                 </td>
  97.  <!-- too long -->
May 11 '10 #4
Dormilich
8,658 Expert Mod 8TB
in Firefox (and any other standard compliant browser) you need to assign an ID for document.getElementById() to work.

PS. for JavaScript matters it is better to post the source code that you copy from the browser. any server side code will be processed on the server and doesn’t directly related to something that’s going on in the browser.
May 11 '10 #5
Plater
7,872 Expert 4TB
I don't see any controls that reference the DisplayMe function?
May 11 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: delerious | last post by:
Please take a look at the following page: If you are using IE: http://home.comcast.net/~delerious1/index2.html If you are using Mozilla: http://home.comcast.net/~delerious1/index2_moz.html I'm...
9
by: Dru | last post by:
Am I missing something simple? I can't figure this one out... <script language="JavaScript" type="text/javascript"> function showDesc(desc) { showDescription.innerText = desc; } </script> ...
18
by: Daniel Billingsley | last post by:
Or seem to anyway. ===== string abc; if ((abc=getString()) != "") { MessageBox.Show(abc); } private string getString() {
21
by: vmsgman | last post by:
Here is a code sample ... int blah = ReadFile( defArray, defFileName, w, h); // Read File Contents into memory array and return for processing public int ReadFile( ref ushort nArray, string...
5
by: tindog | last post by:
I seem to be caught in a bit of a conundrum with C#. First of all getting books on VS 2003.net then VS 2005 comes out and further a book I have bought to just learn just the language C# (in 21...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
9
by: bhavik.patel | last post by:
Hi I have a rather simple question: I have following class definitions: class Base { public: virtual void display ()
4
by: rameshbabucv | last post by:
Run any filter Click on Cancel button from the contacts navigator The page goes back to Filter navigator Run another filter Click on Cancel button from the contacts navigator Instead of...
13
by: linq936 | last post by:
Hi, My program crashes on Linux64 platform. The crash only happens on optimized compiling, if I compile the code in debug mode, it works fine. If I compile the code on Linux 32 platform, neither...
7
by: jharrison | last post by:
I'm finding it hard to make this code work in Python 3.0. Been looking at it for some time now: # import module for random functions import random # List of words for the computer to pick...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.