View Full Version : Guidence with setting a form to update two different URL's

09-11-2007, 10:36 PM
I am posting this here because I am thinking it would require JS to do this or some form of XML, though am just guessing.

Ok, I came up with this idea that I think is pretty neat the other day, so I am now attempting to do a project that entails using one browser window to display two different URL's, (I am thinking of using two iframes one on the left and one on floated to the right both 50% width and 80% height under these I am planning to set a form that includes last name and first name fields in the lower 20%.)

Then I am planning to use mouseover/out's to change the width to 100% whenever one of the loaded URL's is moused over then have it change back to 50% when the mouse is returned to the lower 20% of the screen or if a mouse button is double-clicked (or right clicked?) and visa versa.

I am also wanting to include an auto refresh function for both of the loaded URL's within the iframes that would be set to reload every 15 minutes and have the timer reset upon each new query.

In a nutshell though using forms are new to me and am wondering if/how you:

a. have the queries sent off to two different URL's; and
b. have a those results loaded a given iframe rather then the same window or a new window.


09-12-2007, 05:00 AM
Are the documents that are in the iframe from the same domain? If so, you can just use setInterval to reload the location.

09-12-2007, 06:34 AM
Oh no they are from two different sites neither of which I have access to, I have the GUI portion all setup now and have since run into several issues such as: one of the sites uses VBscript rendering it nonfunctional (except in IE) and when I am in IE it overtakes control of the framed window thus making my attempt feeble, it seems that FF is able to keep the framing in place, but because of the VBscript I am unable to do anything; the other one gives me a password error when I try to login, except in FF but I am not able to use the menu in FF because of the same reason I think (they were poorly written).

Which form of XML would I use to send my fields to the remote server, what I am thinking is for it to function like the search engine bar does in FF, you type in a first and last name hit enter and send it off to the server, except (I need to do it for two servers) and then it returns the results, but I am wanting one to go into a left iframe and the other in a right iframe... I was thinking of using a javascript:function as the action in the form on the framed page, I figure that would permit the queries to be sent off through the use of XML-something. thx.

09-12-2007, 06:37 AM
This is what I have so far:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><html><head>
<title>Automated Wants Intelligence Query v1.0 - AWIQ</title><script language="javascript" type="text/javascript"><!--
function zin(swap){
var chkV=document.getElementById(swap)
function zout(swap){
function process(){
// pass fields for processing on remote server...XML based?

//--></script><style tyle="text/css"><!--
#base{margin-left:auto;margin-right:auto;position:absolute;left:16%;bottom:0%;background-color:#4169E1;border:5px outset #000066;width:650px;padding:10px;margin:10px}
.css{background-color:#000099;font-family:Arial;font-weight:bold;border:1px ridge #B0C4DE;padding:2px 5px}
//--></style></head><body><div id="wrap">
<iframe id="HS" src="http://left site" scrolling="auto" frameborder="1" marginheight="0" marginwidth="0" onMouseOver="zin('HS')" onMouseOut="zout('HS')"></iframe>
<iframe id="SN" src="https://-right site" scrolling="auto" frameborder="1" marginheight="0" marginwidth="0" onMouseOver="zin('SN')" onMouseOut="zout('SN')"></iframe>
<br clear="all" />
<div id="base">
<form action="javascript:process('ln','fn')" method="post">
Last Name:&nbsp;<input type="text" name="ln" width="50" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;First Name:&nbsp;<input type="text" name="fn" width="50" /><br /><br />
<input class="css hl p" type="reset" value="Purge" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="css hl g" type="submit" value="Submit" />

I was wanting to include an onclick or onmousedown function in the two main iframes that would like the view at 100% and then toggle it back to 50% if was already locked, but it does not seem those work within iframes, so I am not seeing that feature being able to work as of now.

09-12-2007, 11:38 PM
You really are very limited to what you can do if the iframe source comes from another domain. This is to prevent people from stealing content as their own, attacking a site using cross-site scripting exploits, or transforming the content for malicious purposes (phishing).

You can send a request to the site and grab the results, but if you want to change the results that come back, you'll have to do this using pure script (usually server-side) to make the request and actually transform it in a string form and output the string as html. Not an iframe solution.

I wouldn't recommend doing that, personally, if the site owner finds out, they may have legal recource to stop you from doing that. It's a form of theft of services. If the site offers an API, use that. Otherwise, this is probably not a good thing to do.

09-13-2007, 08:59 PM
Thanks for the reply... Basically, I am just wanting to have to fill out the fields only once (locally at the bottom of the main browsers window, the first name and last name) by manually typing that in and then sending that off to both of the different servers and have those put into the correct last name and first name fields and then CR it and have the results queried back into the two iframes, this is only to make it so the user only has to type the name in once rather then twice, then later on I was planning on the possiblity of making another database for a related task and include that as a third query within the function. I don't want to change anything only make it easier to perform the task of quering the information... I was also thinking that VBscript allowed the passing of Windows program data to a URL in the same manner (from what I understand about VBscript so far), but was thinking that was would be something for later if it is even possible to do, maybe I am misunderstanding the capability of VBscript, but thought that was the only real advantage there was to using it.

I was thinking this would work just like a spam bot does or like how Firefox works when you type information into one of the toolbar search engines for an semi-automated-query on the WBM, Wikipedia, Merriam-Websters Dictionary, Google, etc. You type it into the field, hit enter, and the results are brought up in the same window, except in this case it would be iframes and two queries would be send off for the same purpose.

09-13-2007, 10:39 PM
Code that executes in a trusted environment, such as an installed browser toolbar, gets to do neat things that client-side javascript running from a website doesn't get to do.