On Friday, May 30, 2003, at 10:09 US/Pacific, Peter Fleck wrote: [..]
I just finished optimizing the javascript for display on multiple browsers and it's working fine for static pages.
[..]

I forget who mentioned it, but making sure that your
'hearTo' documents  are appropriately single quoted is important.

A simple way that I build them out is either to KNOW what
really belongs in them with something simple like


my $jScript = '<script language="JavaScript" type="text/javascript">
<!--
function doit() {
var preThing ="http://";;
var adminRoot ="' . $admin_root . '";
var destBase ="/' . $self_cgi . '/";
if (( document.FormName.H.value != "" )) {
document.FormName.action = preThing + document.FormName.H.value + adminRoot + destBase ;
} else {
document.FormName.action = ".." + destBase;
}

document.FormName.method = "POST";

if ( document.FormName.OpenWinBox.checked ) {
document.FormName.target = "_blank";
}else {
document.FormName.target = "MainData";
}
return(true);
}
//-->
</SCRIPT>
';


my $form = hq_web_form($self_cgi,'post','MainData','FormName','doit()');
...
my $p = $jScript . $form ;

h_white_page("Import Hq Config","Import Hq Config", \$p );
....


or build up that $jScript in sections.... Where we have
to add in really dynamic bits, such as Arrays and the like.

What Tends to DRIVE ME NUTS!!!! is the javaScript Side.

It would have been nice if the DOM's had the idea of
dealing with an Array of One Element.... Which may be what
is killing you.

There are also problems of making sure that your JavaScript
KNOWS to check that you did or did not put an element into
the document.... eg something like

        var callLen = document.FormName.callForm.length ;
        if (( callLen )) {
                // we have MORE than one element in the form
                for (var i=0 ; i < document.FormName.callForm.length; i++ )
                {
                if (( document.FormName.callForm[i].checked )) {
                        if ((document.FormName.callForm[i].value == "hqD_ops")) {
                .....
        } else {
                retval = altFileFinal();
                if (( retval == false )) { return false;}
                document.FormName.callForm.checked = true;
        }

Oh there are some Grave and UnPleasant Things that can go
wrong when trying to create dynamic javaScript - whether you
were trying that with perl, java, python, ruby, and if you
were trying to do this in c89, you really should seek competent
psychiatric help first... 8-)


ciao drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to