AS2 call javascript function of another webpage. help :)

Hi
I have an swf in as2 and when I click a button, I want to open a new html page, and in that page I have a function that depend of the value, i show or hide one table
the question is, how can I open that page and send that value, and in that page show or hide that table?
I have made the swf, and the html
I am using getURL('../test.html?viewHide='2, '_self'); that is sending the value, but I can´t do the function works.
in the html I have this
function viewHide(id)
var targetId, srcElement, targetElement;
var targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
thanks a lot

this is all the html file
I am trying too writing in the address this:
test.html?id=1
and is not working
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
</style>
<script>
function viewHide(id)
    //alert('si');
var targetId, srcElement, targetElement;
var targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
</script>
<script>
function showAlert() {
    alert('valor ' + id + '.');
</script>
<script>
window.onload=function(){
//viewHide("tabla"+window.location.split("=")[1]);
//viewHide(window.location.split("=")[1]);
//viewHide('tabla2');
//var test=viewHide("tabla"+window.location.split("=")[1]);
//var test='1';
var test=('tabla1');
//alert(test);
//viewHide("'"+"tabla"+test+"'");
viewHide(test);
//alert('si');
</script>
    <script> 
      //function load() { 
      //  alert("load event detected!"); 
      //window.onload = load; 
    </script>
</head>
<body>
<center>
<table id=tabla1 style="display:none" width="600" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="html/image1.jpg"/></td>
  </tr>
</table>
<table id=tabla2 style="display:none" width="600" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="html/image2.jpg"/></td>
  </tr>
</table>
<input name="regdom" type="radio" Onclick="viewHide('tabla2')" value="A" >
<input type="button" value="Click Here" onClick="showAlert();">
</center>
</body>
</html>

Similar Messages

  • Calling a function from another class - help!

    I realize that this is probably a basic thing for people who have been working with JavaFX for a while, but it is eluding me, and I have been working on it for over a week.
    I need to call a function that is in another class.  Here's the deal.  In EntryDisplayController.java, there are 2 possible passwords that can be accepted - one will give full access to the car, the second will limit functions on the car.  So when a password is entered and verified as to which one it is, I need to call a function in MainDisplayController.java to set a variable that will let the system know which password is being used - full or restricted.
    So in MainDisplayController.java I have this snippet to see
    public class MainDisplayController implements Initializable, ControlledScreen {
        ScreensController myController;
        public static char restrict;
         * Initializes the controller class.
        @Override
        public void initialize(URL url, ResourceBundle rb) {
            // TODO
        public void setRestriction(){
            restrict = 0;
            restrictLabel.setText("RESTRICTED");
        public void clearRestriction(){
            restrict = 1;
            restrictLabel.setText("");
    And in EntryScreenDisplay.java I have this snippet:
    public class EntryDisplayController implements Initializable, ControlledScreen {
         @FXML
        private Label passwordLabel ;
        static String password = new String();
        static String pwd = new String("");
         ScreensController myController;
         private MainDisplayController controller2;
         * Initializes the controller class.
        @Override
        public void initialize(URL url, ResourceBundle rb) {
            setPW(pwd);    // TODO
         @FXML
        private void goToMainDisplay(ActionEvent event){
            if(password.equals ("123456")){
              controller2.clearRestriction();
               myController.setScreen(ScreensFramework.MainDisplayID);
               pwd = "";
               password = "";
               setPW(pwd);
            else if(password.equals ("123457")){
               controller2.setRestriction();
                myController.setScreen(ScreensFramework.MainDisplayID);
               pwd = "";
               password = "";
               setPW(pwd);
            else{
                password = "";
                pwd = "";
                setPW(pwd);
    When I enter the restricted (or full) password, I get a long list of errors, ending with
    Caused by: java.lang.NullPointerException
      at velocesdisplay.EntryDisplayController.goToMainDisplay(EntryDisplayController.java:60)
    Line 60 is where "controller2.setRestriction(); is.
    As always, thanks for any help.
    Kind regards,
    David

    You never set the controller2 variable to anything, which is why you get a null pointer exception when you try to reference it.
    public static variables (and even singletons) are rarely a good idea as they introduce global state (sometimes they can be, but usually not).
    If a static recorder like this can only have a binary value, use a boolean, if it can have multiple values, use an enum.
    Some of the data sharing solutions in dependency injection - Passing Parameters JavaFX FXML - Stack Overflow might be more appropriate.
    I also created a small framework for roll based solutions in JavaFX which perhaps might be useful:
    http://stackoverflow.com/questions/19666982/is-there-a-way-to-implement-a-property-like-rendered-on-javafx
    https://gist.github.com/jewelsea/7229260
    It was just something I hacked together, so it's not a fully polished solution and you probably don't need something quite so complex.
    What you need is a model class shared between the components of your application.  Dependency injection frameworks such as afterburner.fx can help achieve this in a fairly simple to use way.
    If you don't want to go with a dependency injection framework, then you could use either a static singleton model class for your settings or pass the model class using the mechanism in defined in the passing parameters link I provided.  For a model class example, see the ClickCounter class from this example.   That example doesn't use FXML, but to put it together with the passing parameters solution, for your restriction model, you would have something like the following:
       private class Restricted {
         private final ReadOnlyBooleanWrapper restricted;
         public Restricted(boolen isRestricted) {
           restricted = new ReadOnlyBooleanWrapper(isRestricted);  
         public boolean isRestricted() {
           return restricted.get();
         public ReadOnlyBooleanProperty restrictedProperty() {
           return restricted.getReadOnlyProperty();
    Then in your EntryDisplayController you have:
    @FXML
    public void goToMainDisplay(ActionEvent event) {
         // determine the restriction model as per your original code...
         RestictionModel restrictionModel = new RestrictionModel(<appropriate value>);
      FXMLLoader loader = new FXMLLoader(
      getClass().getResource(
       "mainDisplay.fxml"
      Stage stage = new Stage(StageStyle.DECORATED);
      stage.setScene(
       new Scene(
         (Pane) loader.load()
      MainDisplayController controller =
        loader.<MainDisplayController>getController();
      controller.initRestrictionModel(restrictionModel);
      stage.show();
    class MainDisplayController() {
      @FXML private RestrictionModel restrictionModel;
      @FXML private RestrictLabel restrictLabel;
      public void initialize() {}
      // naming convention (if the restriction model should only be set once per controller, call the method init, otherwise call it set).
      public void initRestrictionModel(RestrictionModel restrictionModel) {
        this.restrictionModel = restrictionModel;
         // take some action based on the new restriction model, for example
        restrictLabel.textProperty.bind(
          restrictionModel.restrictedProperty().asString()
    If you have a centralized controller for your navigation and instantiation of your FXML (like in this small FXML navigation framework), then you can handle the setting of restrictions on new screens centrally within the framework at the point where it loads up FXML or navigates to a screen (it seems like you might already have something like this with your ScreensController class).
    If you do this kind of stuff a lot, then you would probably benefit from a move to a framework like afterburner.  If it is just a few times within your application, then perhaps something like the above outline will give you enough guidance to implement a custom solution.

  • Call Javascript Function Allow Domain

    It took me a while, but I was finally able to get my flash file to call a javascript function on my webpage. I had to add this as2 code:
    System.security.allowDomain("*");
    This fixed my problem, but it causes a compiler error:
    Scene 1, Layer 'Layer 1', Frame 1, Line 3    1119: Access of possibly undefined property security through a reference with static type Class.
    How do I do allow my domain with as3? I tried Security.allowDomain('*') but that doesn't seem to fix my orginal problem.

    OK it's working now with as3 code. On the webpage I had to wait until the dom was ready before calling the as3 function from javascript. I guess the as2 code was just slowing it down enought to make it work.

  • VPD: Problems calling a function on another schema

    Here's the setup:
    I've create a schema called "AllYourBase".  It contains all of my tables, views, functions, procs, etc.
    These tables are protected by a DBMS_RLS policy.  The policy uses a function to define its predicate which looks like this:
    create or replace function tous_filter(schemaName varchar2, tableName varchar2)
    return varchar2 is
    begin
    return  'account = sys_context(''USERENV'', ''CLIENT_IDENTIFIER'')';
    end;
    All of the tables have an account column for this to work.  So far, this is a pretty basic VPD setup.
    I have other db users that login and view data in the "AllYourBase" schema.
    So when "ArbyLong" logs in, I set sys_context('USERENV', 'CLIENT_IDENTIFIER') to "ArbyLong", and when he runs a query, he gets back his rows.
    Now, "AllYourBase" has several functions.  Here's a very contrived, simplified example of one (but it illustrates the issue I'm running into just fine):
    create or replace function getUserID
    return integer is retval integer;
    begin
    select user_id into retval from users;
    return (retval);
    end;
    When "ArbyLong" runs the equivalent query (select user_id from users), he gets back the one row where the account column is equal to "ArbyLong", as expected.
    But this getUserID function lives in the "AllYourBase" schema.  And here's the catch: I've made "AllYourBase" exempt from the policies by running "grant exempt access policy to AllYourBase".
    When "ArbyLong" runs the function getUserID, it runs in the "AllYourBase" schema and pulls ALL of the rows from the users table.
    This particular function simply errors out (since it's only expecting one row), but other functions are returning data that the logged in user shouldn't see.
    So even though there are policies in place, by calling a function on another schema who is exempt from the policies, a user is able to see all returned data and not just the rows they are normally limited to.
    Ultimately my question is this: Is there a way to enforce VPD policies when a user calls a function that lives in another schema?
    Doing my own research, the answers I've come up with are:
    * Don't use "grant exempt policy"!
    * Put the function directly into the users' schemas.  So "ArbyLong" would have his own getUserID function that would look at the "AllYourBase" users table.
    I'd rather not do either of these, so does anyone have any other ideas?  If it turns out these are the only solutions, then I'll go with one of them.
    Thanks!

    Need more info. Are you using a ViewStack or other navigator container, and trying to access a view that has not been displayed yet, due to deferred instantiation?
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • How to call javascript function in Flash

    Please help...
    I have a site that run multiple of domain for example
    Domain (A): raymond.com
    Domain (B): raymond.ca
    The problem is this.. when (B) html page load the flash file
    that locate at (A) it load but non of the buttons work which call
    javascript function using getURL("javascript:showpopup()"); But it
    work fine if all reside on the same domain,eg( (A) html page load
    flash file form (A)). Anyone know how to solve this other than
    create a set of flash files on (B).
    Regards,
    Raymond

    http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=Flash_MX_2004&file=00001750.html

  • How can i call javascript function with out internet connection?

    I have trying to call javascript function through ExternalInterface. But flash player recomonding to have internet connectivity. i have allredy used allowscript="always" .

    first, allow the folder that contains your flash files to connect to the internet by adjusting your security settings:
    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.ht ml
    then try the following in a swf and open the published html in your browser to test:
    import flash.external.ExternalInterface
    ExternalInterface.call("function(){alert('test');}")

  • How to call javascript function & action method on clicking jsf  button?

    I have one jsf custom button. I am checking client side validations in mail by calling javascript function & also sending mail by calling action method of a bean which will execute at server side for onclick event of that button. Because of this when I click on that button its calling both javascript function and action method. So even though validations failed its sending mail. How can I overcome this problem?? Please help me....

    I am asking regarding commanLinks in jsf. I have the following code block in jsf. Even though mailSentMessage('true'); returns false, its calling action="#{emailObjectAction.sendEmail}" method. thats why I got that doubt. try the following code.
    <h:commandLink id="mailBtn123Send"      onclick="return mailSentMessage('true');" value="send mail"     action="#{emailObjectAction.sendEmail}">          
    </h:commandLink>

  • About use mouse middle key to call JavaScript function question

    I want use mouse middle key to call JavaScript function (<a href="javascript:help()">) help() will open a new Window and direct to my GUI Help Page but when I click it with middle key ,it will open new Tab blank Page that url="javascript:help()"; can not Executive help function... Is this a Firefox Bug or correct behavior in Firefox? thank.

    You need to use a left click to handle JavaScript links.
    See also http://kb.mozillazine.org/browser.link.open_newwindow.restriction

  • Can I call a function in another package?

    Dear all,
    Can I call a function in another package?
    Say I have package A, and package B.
    Is it possible for me to call a function in inside package A, within a function inside package B?
    If yes, what's the syntax.
    Thanks in advance!

    The variable in the calling package that will receive the value of the function in the other package needs to be defined based on that type in the other package directly:
    sql>create or replace package pkg_a
      2  is
      3    type testTable is table of varchar2(10) index by binary_integer;
      4 
      5    function f_a return testTable;
      6  end;
      7  /
    Package created.
    sql>create or replace package body pkg_a
      2  is
      3    function f_a
      4      return testTable
      5    is
      6      v_table testTable;
      7    begin
      8      v_table(1) := 'One';
      9      v_table(2) := 'Two';
    10      return v_table;
    11    end; 
    12  end;
    13  /
    Package body created.
    sql>create or replace package pkg_b
      2  is
      3    procedure p_b;
      4  end; 
      5  /
    Package created.
    sql>create or replace package body pkg_b
      2  is
      3    procedure p_b
      4    is
      5      v_table pkg_a.testTable;  -- this variable has to be based on the type in pkg_a
      6    begin
      7      v_table := pkg_a.f_a;
      8      for i in 1..v_table.count loop
      9        dbms_output.put_line( v_table(i) );
    10      end loop;
    11    end;
    12  end; 
    13  /
    Package body created.
    sql>exec pkg_b.p_b
    One
    Two
    PL/SQL procedure successfully completed.

  • How to call javascript function in back bean of jsf

    hi,
    i am trying to call java script function in back bean but not done. Is there any code for call javascript function in bean file.

    Java runs at server side.
    JSF produces HTML output.
    Server sends HTML output to client.
    Java stops running.
    HTML runs at client side.
    JS starts to run in HTML.
    Clear? Java is a server side language. JS is a client side language. To run JS using JSF, simply print it out to the HTML so that it get invoked when the HTML runs.

  • How to call javascript function from PL/SQL procedure

    Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

    Hi,
    I have a requirement to call Javascript function inside a After Submit Process.
    clear requirement below:
    1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
    2. user clicks on "save files" button
    3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
    Hope this clarify U.
    Krishna.

  • Calling a function in another class that is not the App delegate nor a sngl

    Hi all-
    OK- I have searched and read and searched, however I cannot figure out an easy way to call a function in another class if that class is not the app delegate (I have that down) nor a singleton (done that also- but too much code)
    If you use the method Rick posted:
    MainView *myMainView = [[MainView alloc] init];
    [MyMainView goTell];
    That works, however myMainView is a second instance of the class MainView- I want to talk to the instance/Class already instantiated.
    Is there a way to do that without making the class a singleton?
    Thanks!

    I had some trouble wrapping my head around this stuff at first too.
    I've gotten pretty good at letting my objects communicate with one another, however I don't think my method is the most efficient or organized way but I'll try to explain the basic idea.
    When you want a class to be able to talk to another class that's initialized elsewhere, the class your making should just have a pointer in it to the class you want to communicate with. Then at some point (during your init function for example) you should set the pointer to the class you're trying to message.
    for example in the app-delegate assume you have an instance of a MainView class
    and the app-delegate also makes an instance of a class called WorkClass
    If you want WorkClass to know about MainView just give it a pointer of MainView and set it when it's instantiated.
    So WorkClass might be defined something like this
    //WorkClass.h
    @import "MainView.h"
    @interface WorkClass : NSObject
    MainView *myPointerToTheMainView;
    @property (retain) myPointerToTheMainView;
    -(void)tellMainViewHello;
    @end
    //WorkClass.m
    @import "WorkClass.h"
    @implementation WorkClass
    @synthesize myPointerToTheMainView;//this makes getter and setter functions for
    //the pointer and allows us to use the dot
    //syntax to refrence it.
    -(void)tellMainViewHello
    [myPointerToTheMainView hello]; //sends a message to the main view
    //assume the class MainView has defined a
    //method -(void)hello
    @end
    now somewhere in the app delegate you would make the WorkClass instance and pass it a reference to the MainView class so that WorkClass would be able to call it's say hello method, and have the method go where you want (to the single instance of MainView owned by the app-delegate)
    ex:
    //somewhere in app-delegate's initialization
    //assume MainView *theMainView exists and is instantiated.
    WorkClass *myWorkClass = [[WorkClass alloc] init];
    myWorkClass.myPointerToTheMainView = theMainView; //now myWorkClass can speak with
    // the main view through it's
    // reference to it
    I hope that gets the basic idea across.
    I'm pretty new to Obj-c myself so if I made any mistakes or if anyone has a better way to go about this please feel free to add
    Message was edited by: kodafox

  • Calling one function in another function

    Hi,
    How to call one function in another function?
    regards,
    Kishore.

    example:
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    function bob(x number) return number is
      3    begin
      4      return x*x;
      5    end;
      6    function fred(x number) return number is
      7    begin
      8      return x+bob(x);
      9    end;
    10  begin
    11    dbms_output.put_line('Value: '||to_char(fred(5),'fm9999'));
    12* end;
    SQL> /
    Value: 30
    PL/SQL procedure successfully completed.
    SQL>

  • Call javascript function dynamically

    Can this be done to call Javascript function dynamically? What I mean is suppose I use Javascript to submit form and target the reply to a popup window:
      function cForm() {
         win=window.open('','myWin','toolbars=0');
         document.aForm.q.value='12345';     
         document.aForm.target='myWin';
         document.aForm.submit();
      }I target the form reply to popup window myWin. Suppose the reply body contains some Javascript function doX(). Is it possible to call doX() automatically, after the submit and the reply is loaded on myWin, maybe using some onload event in the popup window?

    On the PopUo Windows BODY onLoad, call the method doX()

  • Call javascript function after submit process

    Hi,
    How can I call javascript function after my submit process ?
    Thanks.

    Hi Carl,
    You say that I must have an Item or region that contains my js with conditionnal display. With this method I can execute my js with specific request value.
    My problem is that I tried to integrate the "save large value workaround" in my application with the APEX wysiwyg (fckeditor). To do that I have to call the javascript function clob_submit on the save button. This function save the value of my field but if I want to save other item value, how can I do that ?
    If I use your method, I will submit the page, save the other field and after that, I will branch on the same page. At this moment, I will execute my javascript file.
    Is it what did you said ?
    Sylvain Michaud
    Homepage : http://www.insum.ca
    InSum Solutions' blog : http://insum-apex.blogspot.com

Maybe you are looking for