Jump to content

hacking some javascript


Calamier

Recommended Posts

This is the last trouble im having. I found an alternative method for one of the tasks i was trying to solve earlier. Only it created a new task. I'm using this (Code provided by www.irt.org) :

<script language="JavaScript"><!--function newWindow(file,window) {    msgWindow=open(file,window,'resizable=no,width=200,height=400');    if (msgWindow.opener == null) msgWindow.opener = self;}//--></script><form name="outputForm1"><input type="button" value="Open doc2.html into window2" onClick="newWindow('doc2.html','window2')"><br><input name="outputField1" type="text" value=""><br><input name="outputField2" type="text" value=""></form>

For Doc 1 and this :

<script language="JavaScript"><!--function setForm() {    opener.document.outputForm1.outputField1.value = document.inputForm1.inputField1.value;    opener.document.outputForm1.outputField2.value = document.inputForm1.inputField2.value;    self.close();    return false;}//--></script><form name="inputForm1" onSubmit="return setForm();"><br><input name="inputField1" type="text" value=""><br><input name="inputField2" type="text" value=""><br><input type="submit" value="Update opener"></form>

For doc 2. It works good, my only problem, is now, im using radio buttons instead of text fields, and im trying to figure a way to get multiple radio buttons to update that one text field on the original page. So far i've tryed changing just about every option, if you use the same name for radio buttons, the output will be "undefined" as shown HERE (on step 2, click inventory and select one of the radios)Let me know if you guys can see what im doing wrong...-Calamier

Link to comment
Share on other sites

Change your Doc2 to:

<script type="text/javascript"><!--function setForm() {  var carList = document.inputForm1.inputField  for (c=0; c<carList.length; c++)  { if (carList[c].checked) {        opener.document.outputForm1.outputField1.value = carList[c].value  }}  window.close();  return false;}//--></script><form action="Nothing_in_here" name="inputForm1" onsubmit="return setForm()"><input name="inputField" type="radio" value="Car1" /><br /><input name="inputField" type="radio" value="Car2" /><br /><input type="submit" value="Update opener" /></form>
I hope this works :) Edited by Dan The Prof
Link to comment
Share on other sites

Dan you friggin rock dude. Thanks for the help.I appreciate the help to all who did, skemcin, dan, and aspnetguy and a couple others. I have solved all of the problems I originally came here with, but i'm definitely going to stick around and help out, i've learned more in the past 3 days of Do-it-yourself-ing than i did in the 2 years of html class i took. Thanks a ton guys. Late-Calamier

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...