P
pamelafluente
Hi dears,
I have a plain HTML page.
I want to render it a little interactive. I was thinking to add to it 1
script and events to the elements I want to make interactive.
Then, I need to talk with an ASP.NET page which would actually do some
processing on the server. Processing may include a replace
(regeneration) of the above HTML page, for further interaction.
I have imagined the following scheme, but I need your advise to check
whether I am on the right track, or there are better or more elegant
ways to do that. Criticisms, suggestions, opinions are most welcome.
Here is my demo:
PLAIN HTML PAGE (want to add interactivity to some elements)
===============
<html>
<head><title>
Plain HTM page
</title>
<script type="text/javascript" language="JavaScript">
function Clicked(MyControlID)
{
var obj = document.getElementById("Messenger");
obj.value = MyControlID;
document.form1.submit();
}
</script>
</head>
<body>
<div id="Square1" style="width: 50px; height: 50px;
background-color:green" onclick = "Clicked('Square1')"></div>
<div id="Square2" style="width: 50px; height: 50px;
background-color:Red" onclick = "Clicked('Square2')"></div>
<form name="form1" method="get" action="AspProcessor.aspx"
id="form1">
<input type="hidden" name="ClickedElement" id="Messenger" />
</form>
</body>
</html>
ASP.NET PAGE (will process request and replace html)
============
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Me.Page.Request.HttpMethod = "GET" Then
Response.Write(Me.Page.Request.QueryString("ClickedElement") & " was
clicked")
ElseIf Me.Page.Request.HttpMethod = "POST" Then
Response.Write(Me.Page.Request.Form("ClickedElement") & "
was clicked")
Else
MsgBox("Unexpected method " & Me.Page.Request.HttpMethod)
End If
End Sub
End Class
I have a plain HTML page.
I want to render it a little interactive. I was thinking to add to it 1
script and events to the elements I want to make interactive.
Then, I need to talk with an ASP.NET page which would actually do some
processing on the server. Processing may include a replace
(regeneration) of the above HTML page, for further interaction.
I have imagined the following scheme, but I need your advise to check
whether I am on the right track, or there are better or more elegant
ways to do that. Criticisms, suggestions, opinions are most welcome.
Here is my demo:
PLAIN HTML PAGE (want to add interactivity to some elements)
===============
<html>
<head><title>
Plain HTM page
</title>
<script type="text/javascript" language="JavaScript">
function Clicked(MyControlID)
{
var obj = document.getElementById("Messenger");
obj.value = MyControlID;
document.form1.submit();
}
</script>
</head>
<body>
<div id="Square1" style="width: 50px; height: 50px;
background-color:green" onclick = "Clicked('Square1')"></div>
<div id="Square2" style="width: 50px; height: 50px;
background-color:Red" onclick = "Clicked('Square2')"></div>
<form name="form1" method="get" action="AspProcessor.aspx"
id="form1">
<input type="hidden" name="ClickedElement" id="Messenger" />
</form>
</body>
</html>
ASP.NET PAGE (will process request and replace html)
============
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Me.Page.Request.HttpMethod = "GET" Then
Response.Write(Me.Page.Request.QueryString("ClickedElement") & " was
clicked")
ElseIf Me.Page.Request.HttpMethod = "POST" Then
Response.Write(Me.Page.Request.Form("ClickedElement") & "
was clicked")
Else
MsgBox("Unexpected method " & Me.Page.Request.HttpMethod)
End If
End Sub
End Class