I corrected the code for Firefox and Mozilla based browsers too, it now
Ok I will use this last one. Keep me update with your solution. I will
of course acknowledge this contribution in my final application.
By the way, I am new to this stuff: what is that window.XMLHttpRequest.
Is it another parallel communication channel?
As to your request of clarification about what I am doing here it is
some more detail (let's keep it simple to focus on logic only):
I have a full featured say "server") application which generates very
beautiful
and complex reports in form of html files (also). These html file are
*extremely*
complicated and could not be done (in practice) as ASP pages. They are
generated in no time through a stringbuilder and brutal writing on disk
of the html code through a streamwriter.
Now, I want add some web interactivity to these html reports. That's
way I am
trying to learn somo javascript. For instance, when one clicks on a
cell a drill
down could occur (etc...). The request is sent to the server (through
the mechanism I
schetcked below) and the html report immediately regenerated to show
the new report (eg, drilled down).
This architecture has 2 advantages (that i can see now):
1. Html reports can be ported wherever and still be used as plain html
(if does not want to interact) HERE also I NEED YOUR FUNCTION so in
case an active version is ported will continue to work!!
2. Reports can be very complex in design and are generated at light
speed.
When the user enter a "drill down/roll up" mode the aspx page which
serves as report processor is copied in the folder where the html page
to be
drilled down resides. HERE I NEED again YOUR FUNCTION
Once the information about the cell that is being drilled/rolled
arrives to
the asp page, there is massive code behinde, which also uses several
web services,
which will deal at light speed with al report regeneration issues and
will redirect
the user to the newly generated report. This is extremely fast.
Here is the detail of my logic. If you have advice they are mot
welcome. As usual.
I do want to do this in a nice and efficient way. The test I have done
so far
shoows that while this solution is simple, it is also very fast and
maintenable.
I am kind of confortable with it. I like things simple and effective.
<script language="javascript" src="MyLib.js"></script>
<!-- ----LOGIC EXAMPLE for Laurent ----->
<div id="Square1" onclick = "Clicked(this)" >
<div style="width: 50px; height: 50px; background-color:green"
onmouseover = "mOver(this)" onmouseout = "mOut(this)" ></div>
</div>
<br />
<div id="Square2" onclick = "Clicked(this)" >
<div style="width: 50px; height: 50px; background-color:red"
onmouseover = "mOver(this)" onmouseout = "mOut(this)" ></div>
</div>
<form name="form1" method="get" action="ReportProcessor.aspx"
id="form1">
<input type="hidden" name="ClickedElement" id="Messenger" />
</form>
</body>
</html>
// JScript File -- MyLib.js ---
function Clicked(MyControl)
{
var _CellContent = document.getElementById("Messenger");
_CellContent.value = MyControl.id;
document.form1.submit();
}
function mOver(MyDiv)
{
PreviousStyle = MyDiv.style.borderStyle;
MyDiv.style.borderStyle = "double";
}
function mOut(MyDiv)
{
MyDiv.style.borderStyle = PreviousStyle;
}
ASPX (ReportProcessor.aspx)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
<!-- ----LOGIC EXAMPLE for Laurent ----->
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
Response.Write("Unexpected Method " &
Me.Page.Request.HttpMethod)
End If
'here i get the information about the action being performed by the
user on the HTML
'report and regenerate it accordingly. The report is written brutally
on the hard disk
'through a sreamwriter. This is extremely fast (a few seconds even for
millions report cells).
'Then redirect the user to the newly generated report
'
End Sub
-Pam