• Aucun résultat trouvé

… code javascript intégré par des s.Append(…) …

N/A
N/A
Protected

Academic year: 2022

Partager " … code javascript intégré par des s.Append(…) … "

Copied!
7
0
0

Texte intégral

(1)

! ! " #$ #

%

& ' #

( ) ! * +, #

- . #

/ #

( / 0 0 ' #

& 1 ! 2 * 34 - " & 5#

6 6 & #

#

! 2 1 !

! #

& #

, ! ! 789 9" 3

%: ! 0 ; %: ! :

789 9" 5#

< = 2 =

2 > #

& = " # 3 +, #$ + " 5#

< , ! 2 ! ,

2 =

#

& ? = 1

@ ! ! = 3" A ! # .5 # .#

B 3. 0 >C

50 ' = ! ! A #

(2)

B 0 4 - 0 = ! / 4 - 3

' 5# < = %

<%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false"

Inherits="init_web.WebForm1" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<HTML>

<HEAD>

<title>WebForm1</title>

<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">

<meta name="CODE_LANGUAGE" Content="C#">

<meta name="vs_defaultClientScript" content="JavaScript">

<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

</HEAD>

<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

</form>

</body>

</HTML>

- / ' 2 / 2 !

? %

(3)

D

& = ? %

+ = ! 4 - 0 ! =

2 < , = !

3 = / = 4 - 5#

< 4 - %

6 2 =

! ' 3 0<E, 5% F G C

6 34 - 5 2 =

! 4 - % F 1 G C

! . ! 0 ! ) !

/ +, #$ # + %

%& ) ! ' ! #

%+ ! ' ! # +

#

%+ #

& %

<HTML>

<script language="C#" runat="server">

void Page_Load() { … <code C# …}

void Page_Init() { … <code C# …}

void Page_PreRendeer() { … <code C# …}

</script>

<body >

<asp:Label ID="lb_message" BorderStyle="Inset" Runat="server"></asp:Label>

<% <br> Response.Write("... Code direct ...<br>"); %>

</body>

</HTML>

. ! 0 = " A ! 1

# B = ! ! #

' D ) ! 0 =

! 1 HIIII B ! F ! / ) ! C IIIH#

=@ #" #

0 / ) ! 0 =

HE + # H#

(4)

J

< = ! &K ! ! ?

/ FL G &K L C 3 . ! = !

/ @ #" 3G 5M = !

' N / 3 N O ' 2 55#

+ = 1 =

3 ! " 5#

& = #

!

@ =! P ' Q

+ = ? /. # + =

9 ' #

A & /'1 R !

#

? A ! 9!

" ! 0 2 =

/ 0 = ) ! = D ) ! % 0

#

& .> ; &K E '

! ? %

public class page1_behind : System.Web.UI.Page

{ protected System.Web.UI.WebControls.Label lb_message;

private void Page_Load(object sender, System.EventArgs e) {

Response.Write("... Evènement Load ...<br>");

this.lb_message.Text = "Bienvenue sur ASP.Net";

}

override protected void OnInit(EventArgs e) {

InitializeComponent();

base.OnInit(e);

}

private void InitializeComponent() {

this.Load += new System.EventHandler(this.Page_Load);

this.Init += new System.EventHandler(this.page1_behind_Init);

this.PreRender += new System.EventHandler(this.page1_behind_PreRender);

}

private void page1_behind_Init(object sender, System.EventArgs e) { Response.Write("... Evènement Init...<br>"); }

private void page1_behind_PreRender(object sender, System.EventArgs e) { Response.Write("... Evènement PreRender ...<br>"); }

} }

(5)

N

@ /. ! " ? S / ! !

/ 2 %

$ # 6 2 /. *

2 /. * #

" # $

& = 9! # .#

= " A ! ! !

A 4- / / " < , #

/ ) ! R !

? ? #

= " A ! ! !

#

6 = / ) ! # & ! #

= D T %

, # 3G 5

, #B. 3G 5

@ #@ 3G 5

(6)

8

" #

0 ' 2 R ' + @

#

$ ! ' 2 ' !

* 3

) ! . ! 5#

0 ! ! ! = #

+ = ! ! #

@ ! = " A ! P& Q 4 - #

$ ! '

! #$ # 0 ! ' ! !

. ! ! ! ' +, U#

& 0 . ! 0

4 - * 2 ' ! # $

! ' V ! &K#

< %

protected override void OnPreRender ( EventArgs e ) {

if (!Page.IsClientScriptBlockRegistered("calcule_total")) {

System.Text.StringBuilder s;

s = new System.Text.StringBuilder("<script Language='JavaScript'>");

s.Append("function calcule_total() { ");

… code javascript intégré par des s.Append(…) …

s.Append("}</script>");

Page.RegisterClientScriptBlock("calcule_total", s.ToString() );

}

base.OnPreRender (e);

}

4 - ! ? /

& / ) ! R %

<INPUT type="button" value="Calculer" onclick="calcule_total();" >

! ! ! 0

/ #

(7)

< 2 2 %

$ ! %

! "# ! $

% &"& ' (

% )) ' * (

%$ $ ! & ' () * +,

! ) V # &' 2 *

2 / #$ % /

# #

B 0 0 V 0 / ! 4 - /

/ 2 # / = . / . E .

# . / #

B. ! %

" + ,! -. ./"

B. ! &K %

"0 -1 2/

"0 -1 % " + ,! -.34

" "5 4 3./" 3/

9 ! . E . 92

0 0 !

. %

"0 -1 2/

"0 -1 % " + ,! -.34

" "5 4 3./ innerText3/

! & ' () * +,

A ! 2 2 ! ! !

. %

" + ,! -. ./" % 6 ""

" + ,! -. ./" 7 * % 6 ""

58

"0 -1 " + ,! -. 34

" "5 4 3. / innerText = s_tmp3/

Références

Documents relatifs

In this legacy code, developers can emulate class-based abstractions, i.e., data structures including attributes, methods, constructors, inheritance, etc, using the

Defensive JavaScript (DJS) is a typed subset of JavaScript that guarantees that the functional behavior of a program cannot be tampered with even if it is loaded by and executed

 onmousedown = script The onmousedown event occurs when the pointing device button is pressed over an element. This attribute may be used with

Ecrire le code coffee similaire à cette classe javascript.. var Counter = function () { this.count

Lors de l'ouverture d'une nouvelle fenêtre, vous devez tenir compte de tous les navigateurs : pour Internet Explorer, paramétrez les options left et top ; tous les

Une fonction ou bien un code JavaScript peut être inséré comme valeur de l'argument exemple. Bien évidemment, il est plus intéressant d'utiliser une procédure, lorsque le code

Comment créer une collaboration entre la programmation côté serveur et celle côté client ….. IFT1147 - Au delà du

Script JavaScript intégré dans un code HTML.. Programme JavaScript s’exécutant sur la machine