473,387 Members | 1,575 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.

Getting some exception in my code

I am opening a blank window and writing a javascript on the new window to submit a form.

when I execute a line "newWindow.document.write(newwdtxt2);\n\"(3rd line from last) I get an exception and last two lines do not execute. This problem is seen only in IE 6 with IE 7, It works fine. Below mention is my code.

Expand|Select|Wrap|Line Numbers
  1. /* line breaks added by Mod */
  2. function openWindow(url,name,options) {
  3.        var aToken = "";
  4.         aToken ="2121225434349231132674638921:some";
  5.         if(aToken=="") {
  6.         aToken=document.formEMS.AUTHTOKEN.value; }
  7.        var newWindow = window.open("", name);
  8.         if (!newWindow) return false;
  9.         var newwdtxt = "";
  10.         newwdtxt += "<html><head></head>\n";
  11.         newwdtxt += "<body>\n";
  12.         newwdtxt += "<form name=\"eventForm\" method=\"post\" action="+url+ ">\n";
  13.         newwdtxt += "<input type=\"hidden\" name=\"AUTHTOKEN\"";
  14.        newwdtxt += "value= '";newwdtxt += aToken+"'/>\n";
  15.         newwdtxt += "</form>\n";
  16.         newwdtxt += "<scr";
  17.         var newwdtxt1 = "";
  18.         newwdtxt1 += "ipt type=\"text/javascript\" language=\"javascript\">\n"; 
  19.        newwdtxt1 += "window.onLoad=document.eventForm.submit();\n";
  20.         newwdtxt1 += "</scr";
  21.         var newwdtxt2 = "";
  22.         newwdtxt2 += "ipt>\n";
  23.         newwdtxt2 += "</body></html>\n";
  24.         newWindow.document.write(newwdtxt);
  25.        alert(newwdtxt);
  26.         newWindow.document.write(newwdtxt1);
  27.        alert(newwdtxt1);
  28.         alert(newwdtxt2);
  29.         newWindow.document.write(newwdtxt2);
  30.        alert('wrote newwdtxt2');
  31.         return newWindow; }
Please help me to figure out what is the problem?
Oct 16 '09 #1
2 1121
vituko
48
I think you should group the variables in well formed html blocks, or just use one variable :
Expand|Select|Wrap|Line Numbers
  1. document.write ('<scr') ;
  2. document.write ('ipt>...</scr') ;
  3. document.write ('ipt>') ;
to
Expand|Select|Wrap|Line Numbers
  1. document.write ('<scr'+'ipt>...</scr'+'ipt>') ;
I have no IE 6
Oct 16 '09 #2
acoder
16,027 Expert Mod 8TB
Avoid document.write() and make a page, open that and pass the parameters to it. Since you're posting the form as soon as the page loads, why not do this using a server-side page?
Oct 25 '09 #3

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

Similar topics

3
by: Jas Shultz | last post by:
I'm using Win2K3 Enterprise edition with the latest .NET framework installed. I have this problem with getting "out of disk space" errors. It doesn't happen all the time but it does happen. When...
5
by: Jacek Dziedzic | last post by:
Hi! In my main() function I have a last-resort exception construct that looks like this: int main() { try { // ... program code }
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
13
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
1
by: thangchan | last post by:
Hi all, i am getting SQL update problem. as below ======================error messages ======================= Server Error in '/CMS' Application....
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
12
by: Premal | last post by:
Hi, I tried to make delete operator private for my class. Strangely it is giving me error if I compile that code in VC++.NET. But it compiles successfully on VC++6.o. Can anybody give me inputs...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
2
by: Scott | last post by:
I'm debugging an xmlrpc client/server application. Often when an exception occurs in the server, I receive only a very short error message on the client. For example: xmlrpclib.Fault: <Fault 1:...
1
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.