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

  • Home
  • SEARCH
  • 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 88185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:31:12+00:00 2026-05-10T22:31:12+00:00

I thought this was pretty straight forward but I don’t get the same results

  • 0

I thought this was pretty straight forward but I don’t get the same results as the tutorials I read. I have a button on an html page that calls a function in script tags. I also have a reference to the prototype.js file which I haven’t even begun to implement yet. If I leave that reference in the page, my function call does not work from the button’s onclick event. Below is what is called from the button onclick event.

callIt = function(){  alert('It worked!'); }  </script> 
  • 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. 2026-05-10T22:31:13+00:00Added an answer on May 10, 2026 at 10:31 pm

    A couple of things: first, make sure your HTML is valid. Run it through the validator at http://validator.wc.org.

    Next, once you’re sure that your page is valid, add the prototype.js library as the first script reference on the page:

    <script type='text/javascript' src='prototype.js'></script> 

    Notice that I didn’t close it like this <script ... /> Script blocks need to have an explicit closing tag (at least in XHTML 1.0 Transitional)

    Now, to answer your question, I’m really not sure what you’re asking, but if you wanted to attach the callIt method to the onclick handler of your button using Prototype, then do this:

    Event.observe(window, 'load', function() {     Event.observe('button_id', 'click', callIt);   }); 

    Put this in script tags in the element of the page, below the prototype script reference. This will execute when the DOM is loaded & the button exists on the page.

    Hope this helps.

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

Sidebar

Related Questions

I thought this would be pretty simple, but it is proving a bit more
I started web development some time ago, but have invested essentially all my time
I am trying to use AddThis button on a web page of mine, which
Though my question is pretty straightforward, I failed to find an answer around here:
http://pstreams.sourceforge.net/ pstreams is an apparently very simple library, re-implementing popen() for C++. The library
I'm about writing a CUDA kernel to perform a single operation on every single
Does anyone know of a library that is capable of generating XSL-FO from a
I'm trying to write some computationally intensive code for Windows x64 target, with SSE
I've got a piece of existing code that I'm having problems understanding. I generally
I am trying to implement frustum culling in my OpenGL 2d game. The only

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.