Simple JScript

  • Thread starter Thread starter Jenny
  • Start date Start date
J

Jenny

Hi all,

I wrote a simple asp.net with JScript. But it doesn't work
properly. And I don't know why!

The CodeBehind:

Public Class WebForm1
Inherits System.Web.UI.Page
....

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load

Button1.Attributes.Add("AutoPostBack", "False")
Button1.Attributes.Add("onclick", "openPopup();")

End Sub

End Class

And the html in VisualStudio:

<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1"
name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta
content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<SCRIPT language="JScript">
var oPopup = window.createPopup();
function openPopup()
{
var oPopBody = oPopup.document.body;
oPopBody.innerHTML="<DIV>This is a popup!</DIV>";
oPopup.show(15,150,50,50,document.body);
}
</SCRIPT>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT:
174px; POSITION: absolute; TOP: 95px" runat="server"
Text="Button" Width="233px" Height="64px"
CausesValidation="False"></asp:Button></form>
</body>
</HTML>

Once started and clicked a message (This is a popup)
appears for some ms on the screen (And it doesn't look like
a popup window).

thanks for each help on this

Jenny
 
Hi

AutoPostBack = false should be set at Server Side and not at ClientSide. It
should be

Button.AutoPostBack = false;


HTH
Prasad
 
Back
Top