have the following code on a page: - protected void Page_Load(object sender, EventArgs e)
-
{
-
if (!IsPostBack)
-
{
-
Page.ClientScript.RegisterStartupScript(this.GetType(), "DoPreview",
-
"<script language=javascript>\r\n" +
-
"<!-- \r\n" +
-
"function DoPreview()\r\n" +
-
"{\r\n" +
-
"debugger;\r\n" +
-
"var win=null;\r\n" +
-
"var em = 'email=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsEmail').value;\r\n" +
-
"var fn = '&fname=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsFirstName').value;\r\n" +
-
"var ln = '&lname=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsLastName').value\r\n;" +
-
"var pn = '&phone=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsPhone').value;\r\n" +
-
"var a1 = '&addr1=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsAddress').value;\r\n" +
-
"var a2 = '&addr2=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsAddress2').value;\r\n" +
-
"var ct = '&city=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsCity').value;\r\n" +
-
"var st = '&state=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsState').value;\r\n" +
-
"var zp = '&zip=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsZipCode').value;\r\n" +
-
"var cy = '&cntry=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsCountry').value;\r\n" +
-
"var pm = '&pmsg=' + document.getElementById('ctl00_PlaceHolderMain_txtPersonalMessage').value;\r\n" +
-
"var url = 'DoPreview.aspx?' + em + fn + ln + pn + a1 + a2 + ct + st + zp + cy + pm;\r\n" +
-
"win = window.open(url, null, 'height=700, width=800,status= no, resizable= yes, scrollbars=yes,toolbar=no,location=no,menubar=no');\r\n" +
-
"win.focus();\r\n" +
-
"}\r\n" +
-
" -->\r\n" +
-
"</script>\r\n", false);
-
-
btnPreview.Attributes.Add("OnClick", "DoPreview()");
-
-
}
-
}
the problem arises when I first open the window by pressing the btnPreview. The script gets called, I generate a url dynamically, adding a query string to it. The windown opens successfully the first time, however, if I close the popped up window and press that button again, it gives me the error described in the subject.
Anybody have any ideas why I might be running into this problem?
Thanks.
7 24200
What line do you get the error on?
I get it on the following line:
btnPreview.Attributes.Add("OnClick", "DoPreview()");
OK, what does the code look like client-side (viewing in the browser)? You should be able to get the generated source code by selecting View Source or View Page Source.
Guys, I faced the same error, In my case no StumbleUpon tool was installed. I solved it by dissabling Javascript debugging. Go to IE browser -> Tools->Internet Options -> Advanced -> check 'Dissable script debugging(internet exploere) option. this refers to IE 7.
But it's a JavaScript problem, so disabling debugging won't help solve it.
This line should be like this:
btnPreview.Attributes.Add("OnClick", "DoPreview();");
I guess you have forgotten to add semicolon after function name.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Danny |
last post by:
Hi I don't understand why I keep getting "Error: Object expected" I
tried different things and haven't been able to solve it. I'm a newbie
so I'm not sure what I'm doing wrong. The debugger breaks...
|
by: GHS |
last post by:
I'm writing code to parse a specific website and decided to use MSHTML to
help (instead of regular expressions). The parsing code is complete - looks
very nice if I say so myself. :-)
The...
|
by: Steve Chapel |
last post by:
When I load the page
<https://bugzilla.mozilla.org/attachment.cgi?id=237739with Internet
Explorer 7 RC 1, I get the error "Object Expected" at line 174. When I
click on the button, I also get the...
|
by: monudjn |
last post by:
Hi I am implementing ajax in portal. Using ajax i am able to updating the content of portlets asynchronously. However i am facing a problem
The Problem: While submitting the form i am getting...
|
by: Diego Ruiz |
last post by:
Hi!! my english is not too good, but i'll try it
I have a javascript code:
function executeCommands(inputparms)
{
// Instantiate the Shell object and invoke
its execute method.
...
|
by: RMWChaos |
last post by:
WinVista/IE7
I am getting some weird errors only in IE7, but not in FF2.0.0.8 or NN9. It even happens on this website when I click "Sign In". The error is:
"A Runtime Error has occurred."...
|
by: jasone |
last post by:
hi everyone!
any advice given will be MUCH appreciated, i have spent about 10 hours on this bit of script... a rating system. I am having realt trouble overcoming this problem at runtime
...
|
by: thj |
last post by:
Hi.
I've got this form that I'm trying to validate:
<form id="periodForm" action="" method="post">
<p>
Periode:
<input id="startDate" name="startDate" type="text" size="7"
value="<%=...
|
by: ShyamKrishnegowda |
last post by:
We are writing test scripts to our product.
In one of the script we are facing an issue.
This test script will create a COM component and
executes the following function. O1 and O2 are out...
|
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,...
|
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$) {
}
...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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,...
| |