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 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
  • 1 View
  • 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

Thought this would be pretty straight forward, but my value is remaining the same
I thought this would be pretty straight-forward, but I'm having problems with the Process
I'm new to AutoFac, but I thought this would be pretty straight forward. I've
I have, what I thought was a pretty straight-forward query. In normal Sql this
So I thought this script was pretty straight forward: <a id=BackButtonlnk href=# class=white onClick=history.go(-1)></a>
So im working on this TinyMCE javascript, it should be pretty straight forward, but
Okay at first I thought this would be pretty straightforward. But I can't think
I thought this would be pretty easy but I'm running into all sorts of
OK so I thought this would be pretty simple but it's tripping me up..
I thought this was covered elsewhere but I don't see it now. Anyway, having

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.