الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Javascript Error(still On Lan!)

بدأه GHGH1987 في 6 يوليو 2008 · 4 رد · 660 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Hi guys .. It's me again!

I know my problem may seem to some of you a peice of cake .. but not for Begginers like myself!

I'm having an error when writing this code in my web application:

<%@ Page Language="VB" Title="Start" Theme="Silver" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub startButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)

Me.startButton.Attributes.Add(("onclick"), "window.open('ClientTemplate.aspx','','fullscreen=yes,titlebar=no,toolbar=no,statusbar=no,minimize=no');return false;")

End Sub





Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 

Dim Name As String = CType(Session("ST_NAME"), String) 

Me.Label2.Text = Name

End Sub



Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs)

Response.Write("<script language=""javaScript""> window.open('','_parent','');window.close();</script>")



End Sub

</script>

In the Timer1_Tick, four errors showing (1. Cannot switch views , 2.Statement Cannot appear within a method body End of method assumed.3.String Constants must end with double quote.4.Statement Cannot appear ...etc

I've been searching for a solution for this error the whole day ! i wasn't lucky

Any Help my friends would be apperciated :)

#2
<%@ Page Language="VB" Title="Start" Theme="Silver" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<script runat="server">





	Protected Sub startButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)

		Me.startButton.Attributes.Add(("onclick"), "window.open('ClientTemplate.aspx','','fullscreen=yes,titlebar=no,toolbar=no,statusbar=no,minimize=no');return false;")

	End Sub







	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)	

		Dim Name As String = CType(Session("ST_NAME"), String) 

		Me.Label2.Text = Name

	End Sub







	Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs)

		Response.Write("<script language=""javaScript""> window.open('','_parent','');window.close();</script>")



	End Sub

</script>
#4
System Down كتب:
You should use the ClientScript.RegisterStartupScript command to execute Javascript commands

the error is no longer there .

the timer fires but it does not execute my script window.open(' ','_parent',' '); which is supposed to close the parent winodw without the prompt message.

here's what i wrote:

ClientScript.RegisterClientScriptBlock(Page.GetType, "unique_key", "window.open('', '_parent', '');", True)

any help would be appreciated my friends :)

#5

The problem has been resolved

ScriptManager.RegisterStartupScript(Page, Page.GetType, "unique_key", "window.open('','_parent','');window.close();", True)

[code/]

thx bro System_Down :)

مواضيع مشابهة