|
-
Jun 16th, 2010, 11:29 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] please help
Code:
<script language="javascript" type="text/javascript">
function open()
{
window.open("Default2.aspx","BlueWindow","width=400,height=400");
}
</script>
<asp:Button ID="Button3" runat="server" Text="Open" OnClientClick="open()" />
this did not opened the window......
-
Jun 16th, 2010, 12:04 PM
#2
Re: please help
Hey,
Are you getting any JavaScript errors on the page? If so, what are they?
I suspect the problem here is that it can't find Default2.aspx.
Gary
-
Jun 16th, 2010, 12:10 PM
#3
Thread Starter
Fanatic Member
Re: please help
how to catch the JavaScript errors throwing by the page?
this is what i have in the Default2.aspx:
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="background:blue">
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
-
Jun 16th, 2010, 12:17 PM
#4
Frenzied Member
Re: please help
hey,
could you please change your
Code:
window.open("Default2.aspx","BlueWindow","width=400,height=400");
to
Code:
window.open('Default2.aspx','BlueWindow','width=400,height=400');
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 16th, 2010, 12:20 PM
#5
Fanatic Member
Re: please help
sorry the single quotes wont work............
-
Jun 16th, 2010, 12:22 PM
#6
Thread Starter
Fanatic Member
Re: please help
 Originally Posted by HowTo
sorry the single quotes wont work............
-
Jun 16th, 2010, 12:26 PM
#7
Frenzied Member
Re: please help
it is working with me right now and i test it,
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 16th, 2010, 12:28 PM
#8
Frenzied Member
Re: please help
add this also,
i test it for IE8 and Firefox and it working with single quotes
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 16th, 2010, 12:30 PM
#9
Thread Starter
Fanatic Member
Re: please help
this is what i have:
Code:
function open()
{
window.open('Default2.aspx','BlueWindow','width=400,height=400');
}
but it did not work
-
Jun 16th, 2010, 12:36 PM
#10
Frenzied Member
Re: please help
ok, let's do it in another way
in your page load add these
Code:
Button3.Attributes.Add( "onclick", "open();return false;" );
and try it
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 16th, 2010, 12:44 PM
#11
Frenzied Member
Re: please help
hey, if this didn't work with you, so please make sure that you allow scripting on your browser
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 16th, 2010, 01:13 PM
#12
Thread Starter
Fanatic Member
Re: please help
 Originally Posted by avrail
hey, if this didn't work with you, so please make sure that you allow scripting on your browser
and how to do this?
-
Jun 16th, 2010, 01:28 PM
#13
Frenzied Member
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 16th, 2010, 01:31 PM
#14
Frenzied Member
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 16th, 2010, 11:01 PM
#15
Addicted Member
Re: please help
I don't know if this one is the same with you guys, but here... Going back to your code...
Code:
<script language="javascript" type="text/javascript">
function open()
{
window.open("Default2.aspx","BlueWindow","width=400,height=400");
}
</script>
<asp:Button ID="Button3" runat="server" Text="Open" OnClientClick="open()" />
From my experience, that runat="server" and JavaScript don't mix. If you want to execute this one in JavaScript use this one instead
Code:
<input type="button" id="Button3" value="Open" onclick="open()" />
If you want to keep the runat="server" part, you have to type your code in the aspx.vb file, like so:
Code:
Response.Redirect("Default2.aspx")
-
Jun 16th, 2010, 11:07 PM
#16
Frenzied Member
Re: please help
hey Tommy,
what's going with You ?
still facing problems
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 17th, 2010, 01:31 AM
#17
Re: please help
Claude,
That isn't quite true.
The runat=server attribute is definitely required, as this indicates that the button control is an ASP.Net Control, and will be treated as such when the page is parsed by the ASP.Net engine. Without it, the button will not function.
What the OP could do though is not use an ASP.Net Control, but rather an HTML control, such as <input> with a type of Button, and then use the onclick event do to the window.open.
Tommy.Net, it would appear that the function name "open" is reserved, that is why it is not working. Change you function name to something other than open, and it should work.
Gary
-
Jun 17th, 2010, 02:06 AM
#18
Addicted Member
Re: please help
The runat=server attribute is definitely required, as this indicates that the button control is an ASP.Net Control, and will be treated as such when the page is parsed by the ASP.Net engine. Without it, the button will not function.
Yep, I know. That's why I suggested he could try changing the <asp:Button> control with the <input> tag. I have the exact problem with JavaScript recently. I keep on reviewing and re-typing my script but I still found no errors, the function won't execute. Changing the ASP.NET control to a HTML tag solves it since I don't need any server side scripts.
-
Jun 17th, 2010, 07:45 AM
#19
Frenzied Member
Re: please help
 Originally Posted by Claude2005
Yep, I know. That's why I suggested he could try changing the <asp:Button> control with the <input> tag. I have the exact problem with JavaScript recently. I keep on reviewing and re-typing my script but I still found no errors, the function won't execute. Changing the ASP.NET control to a HTML tag solves it since I don't need any server side scripts. 
hey Claude,
tommy codes should be work fine, the most important thing is that, we need to know why this happens.
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 17th, 2010, 08:31 AM
#20
Thread Starter
Fanatic Member
Re: please help
nope...........the problem is not yet solved
-
Jun 17th, 2010, 08:35 AM
#21
Thread Starter
Fanatic Member
Re: please help
when i changed the function name from open to open1 then a postback takes place but did not opened the new window............
earlier when i tried with the function name open then no postback takes place 
suggessions?
-
Jun 17th, 2010, 10:08 AM
#22
Re: please help
This is the code that I used:
Code:
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function opengary() {
alert("hi");
window.open("WebForm1.aspx", "BlueWindow", "width=400,height=400");
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return opengary()" />
</div>
</form>
</body>
Gary
-
Jun 17th, 2010, 11:45 AM
#23
Frenzied Member
Re: please help
hey tommy,
if the gep code's above didn't solve your problem,
please could you send us the error message that appears,
or if you can debug your JavaScript, this will help more,
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 17th, 2010, 11:26 PM
#24
Thread Starter
Fanatic Member
Re: please help
 Originally Posted by avrail
please could you send us the error message that appears
no error message appears 
 Originally Posted by avrail
if you can debug your JavaScript, this will help more,
how to do this?
-
Jun 18th, 2010, 01:11 AM
#25
Re: please help
Hey,
Did you take the code exactly as I posted above?
If so, I don't see any reason why this wouldn't work?!?
Can you post ALL the code that you are currently using?
Which browser are you using? The way to see JavaScript errors varies based on which browser you are using.
Gary
-
Jun 18th, 2010, 03:48 AM
#26
Frenzied Member
Re: please help
 Originally Posted by Tommy.net
no error message appears
how to do this?
hey,
about how to do it, let us know first which browser you are using,
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 18th, 2010, 11:29 AM
#27
Thread Starter
Fanatic Member
Re: please help
ok now i get it working.......geps code is working good for me.......
what was the fault in the code that i posted in my 1st post of this thread?Was it the function name open?
one more thing i would like to ask:i am using the IE7 browser......so how to check what error does my javascript code is throwing?
-
Jun 18th, 2010, 11:39 AM
#28
Frenzied Member
Re: please help
good to hear this at last,
actually I used IE8 and from tools there is an item named Developer tools,
this tool you can use it for debugging your JavaScript codes, I don't really know is it exist for IE7 or not,
but i believe that you can check for that on google
don't forget to mark the thread as resolved
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 18th, 2010, 11:41 AM
#29
Fanatic Member
Re: please help
 Originally Posted by Tommy.net
what was the fault in the code that i posted in my 1st post of this thread?Was it the function name open?
????
-
Jun 18th, 2010, 11:46 AM
#30
Fanatic Member
Re: please help
 Originally Posted by avrail
this tool you can use it for debugging your JavaScript codes
i cant find the tool in my IE8.......can you please help me
-
Jun 18th, 2010, 11:58 AM
#31
Re: [RESOLVED] please help
Yes, it was the function name that was causing the problem.
In IE8, go to Tools | Developer Tools.
Gary
-
Jun 18th, 2010, 12:04 PM
#32
Frenzied Member
Re: please help
 Originally Posted by HowTo
i cant find the tool in my IE8.......can you please help me
hey,
I believed that gep had answer the Question.
i think it is clear now, if not let us know
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Jun 18th, 2010, 12:09 PM
#33
Frenzied Member
Re: please help
 Originally Posted by Tommy.net
no error message appears 
hey,
about this you will see the error message if there is any for the website JavaScript errors, at the bottom of the browser on your left.
double click on it, you will see the error message
Last edited by avrail; Jun 18th, 2010 at 12:12 PM.
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|