Results 1 to 2 of 2

Thread: running javascript function without event handler

  1. #1
    Join Date
    Dec 2006

    running javascript function without event handler

    Take a look at this page please, its on my development server.


    If its not available, sorry, my PC must be off.

    Choose a development from the 3rd drop down on the left hand side, and you'll see some buttons appear just under the commercial property image in the right column. These buttons use AJAX to change the contents of the middle column. Most aren't wired up, but mortgage calculator is if you want to try.

    My issue is with the view location map button. I want the html that this creates and places within the middle column to run a javascript function. Currently as you can see, clicking on the view location map button places a show maps button in the middle column, and if you click on that, the two maps appear, same location but at different zoom levels (its the location of Chichester Police Station (West Sussex, UK) if you must know !!!!).

    I really want to be able to not have the show maps button, just run the javascript. Because its AJAX, < body onLoad="my function()" > doesn't run the javascript function.

    Any ideas on how I can achieve this. All help really appreciated. Page will probably disappear about midnight GMT until some time tomorrow morning, my PC needs his sleep


  2. #2
    Join Date
    May 2005
    Dirty Jersey
    this is a common issue ive seen. the only solution i am aware of is to "eval()" the javascript that you want to run during the ajax retreival. the major problem there is that you have to have pure javascript to eval. it cant be mixed with HTML and other stuff because "eval()" is simply designed to run javascript coding.

    if you know DOM very well, you could take your AJAX responses, code them to be appendChild-able (would take care of updating your page with the HTML elements), and then after that, you could evaluate the javascript.

    1. If you reply to my post, and your reply would then appear directly beneath my post, DON'T QUOTE MY ENTIRE POST!!! IT'S REDUNTANT!!! IT'S ASININE!!!! IT'S REDUNDANTLY ASININE!!!!! DON'T DO IT!!!!
    2. jQuery extends the functionality of JavaScript. If you don't know JavaScript, give up on that jQuery script and learn JavaScript. You'll save yourself a lot of frustration, I promise.
    3. Use the [code][/code] tags. Otherwise, you may be left wondering why no one responded to your eyesore of a thread.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center