473,396 Members | 1,916 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,396 software developers and data experts.

can somebody resolve this

Please can somebody show me a way to work around this. It works in IE6 but doesn't in Mozilla 2.0.0.4.
the code is just a prototype that was written minutes ago and i tried commenting it a lot for readability.
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2. var txt = "";
  3. function prompter()
  4. {
  5. txt+="Do you want to write your message from scratch?\n";
  6. txt+="If yes, click OK button. If No, click CANCEL button."
  7. if (confirm(txt)){
  8. //clear the document
  9. document.form1.reset();
  10. };
  11. }
  12. function sender()
  13. {
  14. //pick message in message field
  15. var name= document.form1.elements[0].value;
  16. //pick email address
  17. var mail = document.form1.elements[1].value;
  18. var textMessage = document.form1.elements[2].value;
  19. var condolenceWindow = window.open("condolencepage.htm"); //do create one yourself please
  20. var insertThis = "Condolence message from "+name+"\n"+textMessage+"\n"+mail;
  21. //problem starts from here. 
  22. var holdBody = condolenceWindow.document.childNodes[0].childNodes[1];
  23. var holdText = condolenceWindow.document.createTextNode(insertThis);
  24. var holdPara = condolenceWindow.document.createElement("p");
  25. holdPara.appendChild(holdText);
  26. holdBody.appendChild(holdPara);
  27. alert("Your message is now on record and the family will reply in due course.");
  28. }
  29. </script>
  30.  
  31. </head>
  32.  
  33. <body>
  34. <form id="form1" name="form1" method="post" action="">
  35.  
  36.   <label>Name
  37.   <input type="text" name="textfield" accesskey="N" />
  38.   </label><br/>
  39.   <label>Email Address
  40.   <input type="text" name="textfield2" accesskey="A" />
  41.   </label><br/><label> Insert you r</label><br/><textarea name="message" cols="30" rows="20" id="condolence" accesskey="C" title="Condolence Message" dir="ltr" lang="en"></textarea><br/>
  42.   <label>Submit
  43.   <input type="button" name="Submit" value="Submit" accesskey="S" onclick="sender()"/>
  44.   </label><input name="Reset" type="button" accesskey="R" value="Reset" onclick="prompter()" />
  45. </form>  
  46. </body>
  47. </html>
i even tried getElementByTag and ByName. Puzzling.
Jul 19 '07 #1
8 1386
pbmods
5,821 Expert 4TB
Heya, emekadavid.

What error are you getting?
Jul 19 '07 #2
gits
5,390 Expert Mod 4TB
hi ...

do you get any errors in Firefox's Javascript-Console?

kind regards
Jul 19 '07 #3
gits
5,390 Expert Mod 4TB
Heya, emekadavid.

What error are you getting?
heya ;) ... we always post nearly the same time today ;)) ...
Jul 19 '07 #4
no error , blank. explorer shows the text, that's why am bothered
Jul 20 '07 #5
gits
5,390 Expert Mod 4TB
try the following:

Expand|Select|Wrap|Line Numbers
  1. var holdBody = condolenceWindow.document.lastChild;
kind regards
Jul 20 '07 #6
gits
5,390 Expert Mod 4TB
and i think you should wait a moment for the document to be ready:

Expand|Select|Wrap|Line Numbers
  1. condolenceWindow.onload = function() {
  2.       //problem started from here :)
  3.       var holdBody = condolenceWindow.document.lastChild;
  4.       var holdText = condolenceWindow.document.createTextNode(insertThis);
  5.       var holdPara = condolenceWindow.document.createElement("p");
  6.       holdPara.appendChild(holdText);
  7.       holdBody.appendChild(holdPara);
  8. }
(note to remove the spaces in line 4 between Thi and s when you copy and paste the code ;))

with that it should reliably work ...

kind regards
Jul 20 '07 #7
thanks gits but lastChild didn't work. i tried that twice. ByTags doesn't and so does anything but childNodes and except for IE6
Jul 20 '07 #8
gits
5,390 Expert Mod 4TB
thanks gits but lastChild didn't work. i tried that twice. ByTags doesn't and so does anything but childNodes and except for IE6
i think it works but you have to consider my last post too ... do the onload-handling i showed you ... its essential ;)

kind regards
Jul 20 '07 #9

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

Similar topics

6
by: John | last post by:
Hi Right password -> ORA-12154: TNS:Could not resolve service name wrong password => ORA-01017: invalid username/password; logon denied Tested on a Windows XP client connecting to Oracle on...
6
by: Luigi | last post by:
Another bug in IE 6 win. The posted page shows the error. They are four: 1) on the top edge, the upper margin of the container is not added with the body's padding. Instead it seems the two...
2
by: asanford | last post by:
We use StackWalk(StackWalk64) from dbghelp.dll to walk our callstacksas needed, using the various Sym* methods (SymGetSymFromAddr, SymGetLineFromAddr) to resolve source file, function name, and...
0
by: Mike Eaton | last post by:
Hi all, I'm getting an error when I attempt to run the Dns.Resolve(hostName) method: No more results can be returned by WSALookupServiceNext I am able to ping the hostname I'm attempting...
7
by: kvnsdr | last post by:
I can type an IP address and receive Internet domain name and my workstation name however no other IPs of computers on our internal network will resolve to a thier machine name only to the same IP...
1
by: vsp15584 | last post by:
Hii..i use the coding as below :- import java.applet.applet; import java.awt.*; import com.sun.j3d.utils.applet.mainframe; import com.sun.j3d.utils.universe.*; import...
1
by: ivanet | last post by:
Hello everyone, I am trying to use the following Schema but I get the error "src- resolve: Cannot resolve the name 'ValuesList' to a(n) 'element declaration' component." at line 144. I have...
4
by: =?Utf-8?B?SnVhbiBEZW50?= | last post by:
Hi, I am getting the following in a VC++ EXE (using VS2005) that links several C++ DLLs and uses MFC and ATL, when I try to start it under the debugger: ------- 'Exactus.UX.Studio.v1.exe':...
3
by: Sindhu Rani | last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do??? C:\s\source>javac -d ..\classes devtestdrive.java devtestdrive.java:5: cannot resolve symbol...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.