Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8054837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:14:15+00:00 2026-06-05T08:14:15+00:00

I’m specifically talking about the IE embedded script language PerlScript from ActiveState. I currently

  • 0

I’m specifically talking about the IE embedded script language “PerlScript” from ActiveState.

I currently have the following, but when button 3 is pressed, no action happens.

<html>
    <head>
        <title>perlscript baby!</title>
    </head>

    <script language="perlscript" event="onload" for="window">
        sub yawn
        {
            $window->alert("hi!");
        }
        sub createNew
        {
            $b = $window->document->createElement('button');
            $b->{value} = "button 3";
            $b->{onclick} = "yawn()";
            $window->alert("Button: " . $b->{outerHTML});
            $window->document->body->appendChild($b);
        }
        sub enable
        {
            undef $window->document->all('buttn 2')->{disabled};
        }
    </script>

   <body>
       <input id='enabler' type='button' value='button 1' onclick='enable()'></input>
       <input id='action' type='button' value='button 2' disabled onclick="createNew()"></input>
   </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:14:16+00:00Added an answer on June 5, 2026 at 8:14 am

    This is a very difficult thing to achieve, apparently. The browser (IE9 in my case) is expecting the value of the onclick attribute (when set from a script) to be a function reference rather than a string. We can prove this by converting your code into the equivalent JavaScript as shown below.

    <script language="javascript">
        function yawn()
        {
            window.alert("hi!");
        }
        function createNew()
        {
            b = window.document.createElement('button');
            b.value = "button 3";
            b.onclick = "yawn()";
            window.alert("Button: " + b.outerHTML);
            window.document.body.appendChild(b);
        }
        function enable()
        {
            window.document.getElementById("action").removeAttribute("disabled");
        }
     </script>
    

    If we run this, the third button will appear, but clicking it will do nothing. We need to make only a minor adjustment to make this work in JavaScript.

    function createNew()
    {
        // ...
        b.onclick = function() { yawn(); };
        // ...
    }
    

    Now, if we convert this back to the equivalent perlscript, we can see that it still doesn’t work.

    sub yawn
    {
        $window->alert("hi!");
    }
    sub createNew
    {
        $b = $window->document->createElement('button');
        $b->{value} = "button 3";
        $b->{onclick} = sub { $window->yawn(); };
        $window->alert("Button: " . $b->{outerHTML});
        $window->document->body->appendChild($b);
    }
    sub enable
    {
        $window->document->getElementById("action")->removeAttribute("disabled");
    }
    

    In fact, it’s a little bit worse because now, if you use your favourite HTML debugger to inspect the button 3 element, there is no onclick handler at all. So what can we do to get around this? Well, the answer is actually pretty simple – don’t use PerlScript to create the elements dynamically, instead, create them statically and use PerlScript to hide and show them.

    <html>
        <head>
            <title>perlscript baby!</title>
        </head>
        <script language="perlscript">
            sub yawn
            {
                $window->alert("hi!");
            }
            sub createNew
            {
                $window->document->getElementById('button3')->style->{display} = "inline";
            }
            sub enable
            {
                $window->document->getElementById("action")->removeAttribute('disabled');
            }
        </script>
        <body>
    
            <input id='enabler' type='button' value='button 1'
                onclick='javascript:enable();' />
    
            <input id='action' type='button' value='button 2' disabled
                onclick='javascript:createNew();' />
    
            <input id='button3' type='button' value='button 3' style='display:none;'
                onclick='javascript:yawn();'/>
    
        </body>
    </html>
    

    This seems to do the job nicely, although I’m not sure how well it will fit into your use case. There is of course, one massively weird thing in this code: the onclick handlers for each of the input elements explictly states that it is calling a JavaScript function. This is not true, obviously, as those functions are actually PerlScript subroutines. However, if you remove the javascript: prefix, then the handlers are never called. I think this just further highlights the browser’s bias towards JavaScript.

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.