View Full Version : Using JavaScript to pass the html from a frame to a form

12-13-2007, 01:46 AM
I am trying to use JavaScript and frames to allow someone to log into a website on another server in a frame off of a page coming from my server, navigate to a page on that server, and then submit, via a form that uploads the contents of that frame to my server for processing.

I am mainly a PHP programer and a bit lost where it comes to JavaScript.

The reason for this is the company I work for has introduced a web based scheduling program, at our location we need an hour by hour break down of staffing and their program does not offer this. I would like to be able to generate this without having the user save the html to a local file and then upload it to my server.

Any ideas??


rnd me
12-13-2007, 12:48 PM
unless the framed page will allow you to run your own scripts on that page, you won't be able to easily do what you describe.

javascript is not supposed to be able to cross frame coing from different webpages.

one way around it would be to use a pop-up window instead of a frame.
make sure you include the feature to display bookmarks.

the user would then click a bookmarklet from the pop-up window, which injects javascript into the pop-ups document.

all that would need to be done is:
create a new form tag, method = POST, action=yourPHP page.
add an input to that form.
set the input value=document.body.innerHTML
submit the form.

this must be done using a bookmarklet, or the security limits will kill it.

read up about these methods here (http://slayeroffice.com/articles/favelet_article.html).