By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,330 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

Immedi :Code works in IE but not in any other Browsers(Tested in Mozilla/Not working)

P: 6
Please Help me in this

My Code is
----------------
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="Fi._Default" %>
  2.  
  3. <html>
  4. <head>
  5. <title>Member Login</title>
  6. <script type= "text/javascript" language="JavaScript">
  7.     function submitTheForm() {
  8.         var XmlRequest = '<%= XmlRequest %>';
  9.         var URLRequest = '<%= URLRequest %>';
  10.  
  11.         document.getElementById("XMLPost").value = XmlRequest;
  12.         //XmlRequest = document.getElementById("XMLPost").innerText;
  13.         document.frmPass.method = "post";
  14.         document.frmPass.action = URLRequest;
  15.         document.frmPass.submit();
  16.     }
  17. </script>
  18. </head>
  19.  
  20. <body onload="submitTheForm()">
  21. <form  action="" name="frmPass" >
  22. <table border="0" align="center" width="600" cellspacing="0" cellpadding="0">
  23. <tr><td>
  24. <textarea name="XMLPost" rows="25" cols="80"></textarea>
  25. </td></tr>
  26. </table>
  27. </form>
  28. </body>
  29.  
  30. </html>
here iam posting my XML data to other URL(http://wonderworld/xxx.aspx).

Iam having Issue with document.getElementById.
It works fine with above code in IE but nothing happens in FireFox.

When I place all the xml below text area and use a submit button it works.

I used InnerText,value,innerHTML all all properties but no use.

Also I used type="application/javascript"

Thanks in Advance.
Feb 12 '09 #1
Share this Question
Share on Google+
4 Replies


RamananKalirajan
100+
P: 607
Hi, in the form you are having the name attribute but not the id attribute. Incude id attribute. Hope it will resolve the problem..

Expand|Select|Wrap|Line Numbers
  1. <form name="frmExample" id="frmExample" action=".....">
  2.  
Regards
Ramanan Kalirajan
Feb 13 '09 #2

P: 6
I Tried using the id field in form tag.
But It didnot help me.

Any One please Help
Feb 17 '09 #3

P: 6
I Got This Worked after I tried using the id attribute in TextArea Tag.


Thanks a Lot Ramanan for giving me an Idea and Thought.

And Thanks to All who Viewed my Post.

Iam Posting the whole code below which works on IE,Safari and FireFox.

---------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="terriblev._Default" %>
  2.  
  3. <html>
  4. <head>
  5. <title>Member Login</title>
  6. <script LANGUAGE="JavaScript">
  7.     function submitTheForm() {
  8.         var XmlRequest = '<%= XmlRequest %>';
  9.         document.getElementById("XMLPost").value = XmlRequest;
  10.         document.frmPass.submit();
  11.     }
  12. </script>
  13. </head>
  14.  
  15. <body  onload="submitTheForm()" bgcolor="#D2E4FC">
  16. <form  action="https://www.terrible.com/default.aspx" name="frmPass" method="post">
  17. <table border="0" align="center" width="600" cellspacing="0" cellpadding="0"
  18.  
  19. <tr><td><textarea name="XMLPost" id="XMLPost" rows="25" cols="80" readonly="readonly" style="visibility:hidden">
  20. </textarea>
  21. </td></tr>
  22. </table>
  23. </form>
  24. </body>
  25. </html>
Feb 17 '09 #4

Dormilich
Expert Mod 5K+
P: 8,639
note: <script> should be served with a type attribute, and attribute names should be lowercase.

PS: maybe you are interested in the event handlers (addEventListener(), removeEventListener()), it makes up for cleaner HTML mark-up.
Feb 17 '09 #5

Post your reply

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