[Javascript] How to make JavaScript execute another document's URL "onclick"?
Ron Wingfield
rtwingfield at archaxis.net
Wed Jan 12 16:54:10 CST 2005
I've implemented the following popup menu via the Perl CGI:
$cgi-> popup_menu
(
-name=>'ap_name',
-values=>\@ap_names,
-labels=>\%ap_labels,
-size=>'8',
-onclick=>"set_apx( )",
-language=>"javascript"
),
This is the set_apx( ) function that executes with the "onclick" action :
qq(<script language="javascript"><!--
function set_apx( ) {
var ap_name;
ap_name=apps_menu['ap_name'].value;
alert(ap_name); // Temp! display the ap_name.
// document.apps_menu.action=apps_menu['ap_name'].value;
// document.apps_menu.action=ap_name;
ap_name.submit( );
}
// --></script>),
Either of the two commented-out lines (as I understand and expected) should accomplish the same result with JavaScript executing, branching, or otherwise transfering (. . .whatever) to the URL; however, nothing (other than the alert) appears to happen when a row is clicked. When a popup menu row is clicked, with the submit function call enabled (as shown above), MS/IE returns the following message (I guess I understand this because from what I've read, submit( ) is associated with a document's internal forms, rather than an external URL ?):
Error: Object doesn't support this property or method.
The value of the variable, ap_name, is correct (per the alert display). This application name is the URL that I want to execute (publish, . . .whatever). I have tried so many things to start the URL. What should I be thinking or reading?
Should I expect the JavaScript instruction, document.apps_menu.action=ap_name; , to branch to another URL? I guess I need to see an example.
OTTF,
Ron Wingfield
FreeBSD 4.8 -- Apache http 2.0.28 -- MySQL client/server 4.1.7
Perl 5.8.5 -- p5-DBD-mysql-2.9004 driver -- p5-DBI-1.46
--------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20050112/132786c5/attachment.htm>
More information about the Javascript
mailing list