Stefan,

I too had A LOT of trouble with JavaScripts , with Netscape. The original
code worked on IE but then when I tried Netscape here is what I had to do:

1) Any JavaScript I wanted to include from a separate file
...
my $csript = IncludeScript();
print $q->start_html(-title=>$title, -script=>$cript);
...
sub IncludeScript {
        open SCRIPT_SRC, "Library/JavaScripts/ca_maintenance.js"
        or dienice('Open(Scripts) - Failed');
            my $JSCRIPT='';
        while (<SCRIPT_SRC>) {
                $JSCRIPT .= $_;
                }
        close SCRIPT_SRC;
        return $JSCRIPT;
}

This looks just like the example in the CGI doc .... and ONLY way I could
get the source included !

2) in-line
...
print <<SCRIPT1A;
<SCRIPT LANGUAGE='JavaScript'>
SCRIPT1A
        print <<SCRIPT1B if $button1;
document.account_form.active_ind[$a].checked = true;
document.account_form.active_account_indicator.value='$b';
document.account_form.active_account_indicator_old.value='$c';
SCRIPT1B
        print <<SCRIPT1C if $button2;
document.account_form.rep_approve[$d].checked = true;
document.account_form.client_rep_approved_ind.value='$e';
SCRIPT1C
        print <<SCRIPT1D;
</SCRIPT>
SCRIPT1D
...

These are the ONLY ways I could get these two options to work w/Netscape ...

and yes I can end up with:

<SCRIPT LANGUAGE='JavaScript'>
</SCRIPT>

but that has not been a problem .... 

3) Seems like if "onClick" script extents passed end of line I also line had
trouble if a "newline" was in source ... I had "logically" broken the script
"string" so I could read it easier ... but put it back as one long string
...



Hope this helps ... this represents a day's labor and many, many different
ways of trying ...

If anyone else has had experiences they could share I too would greatly
appreciate any suggestions or advise ...


jwm

-----Original Message-----
From: Stefan Ward [mailto:[EMAIL PROTECTED]]
Sent: August 06, 2001 20:25
To: [EMAIL PROTECTED]
Subject: running a Java Script from a CGI


This is a snip of code i have in a CGI.  I am having trouble getting ANY
java script to run from within a CGI.  I would appreciate some help with why
this isn't running right.  I have looked on the web (do a search on google
with java in the box, hahaha) for a good resource to help me figure out how
to run other Java Scripts from within a CGI help with finding one would be
appreciated.

if ($query->param('list_name') eq 'Star Wars Galaxies')
{



<Head>
<SCRIPT LANGUAGE="JavaScript">

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops =
'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',r
esizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
</script>
</HEAD>
<BODY>

print q|<A HREF="http://station.com/docs/swgaldocs.htm";
       onclick="NewWindow(this.href,'name','400','400','yes');return
false;">Report Documentation</a>|;
</BODY>
}



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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

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

Reply via email to