Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. generated HTML calling javascript functions

generated HTML calling javascript functions

Scheduled Pinned Locked Moved JavaScript
perljavascripthtmlhardwaretools
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KingDidd
    wrote on last edited by
    #1

    I have been going nuts trying to figure out how to get a dynamically generated web page to call a javascript function. It all started with Neeraj Saluja's nifty HTML bar charts. I have a web page which calls a CGI perl script to generate a new page. On that page is a button which calls the barchart() function. The barchart() function in turn generates a Content string, which is then written to a new window, displaying the chart. I'd like to have an active link in the chart, which when clicked will call a function for displaying additional information about the chart element being clicked. If you've worked with those bar charts, and can help me figure out a way to define a function to be called when clicking on a link in the chart, I'd love to hear about it. the CGI script generates a complete page, with its own ... sections. A function defined there generates the bar chart page, which needs its own section for defining the function I want to call by clicking in the chart, but that has to be embedded in the string already being written by CGI. It's too ghastly for words.</x-turndown>

    B 1 Reply Last reply
    0
    • K KingDidd

      I have been going nuts trying to figure out how to get a dynamically generated web page to call a javascript function. It all started with Neeraj Saluja's nifty HTML bar charts. I have a web page which calls a CGI perl script to generate a new page. On that page is a button which calls the barchart() function. The barchart() function in turn generates a Content string, which is then written to a new window, displaying the chart. I'd like to have an active link in the chart, which when clicked will call a function for displaying additional information about the chart element being clicked. If you've worked with those bar charts, and can help me figure out a way to define a function to be called when clicking on a link in the chart, I'd love to hear about it. the CGI script generates a complete page, with its own ... sections. A function defined there generates the bar chart page, which needs its own section for defining the function I want to call by clicking in the chart, but that has to be embedded in the string already being written by CGI. It's too ghastly for words.</x-turndown>

      B Offline
      B Offline
      Benaiah Mischenko
      wrote on last edited by
      #2

      If I'm understanding you correctly, you could simply use an XmlHttpRequest to AJAX-load the generated page, then pluck out the chart using jQuery or something similar to stick it in your page. Just a suggestion - I may be missing your problem entirely. EDIT: Read over your question a few more times, realized I missed the point. If these are really separate pages, then the only way to communicate between them without a refresh would be for the "show more info" page to use continual AJAX checks to a third file (on the server) that would be written to by the chart click (again, using AJAX) to notify the other page of the click. It's probably easier to bite the bullet and go with a refresh and regeneration of the info page on a chart click. Is that not an option? Sorry for my first response, it was very stupid.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups