javascript manipulating multiple pages and forms

They have: 461 posts

Joined: Jul 2003

javascript manipulating multiple pages and forms

ack! not sure where this goes wrong. i have a page for making journal entries (one must be signed in to make them, so instead of linking you to the page, here' sa link to a screen shot incase you care to see what it looks like: http://24.91.157.113/findyourdesire/journal-make.jpg ) which has a form. that form has a feild called "mood" and one called "mil" (short for Mood Image Location). i'm trying to update these from a form in a window that is opened by a link on the page.

this window that is opened (horrendously oversized since i haven't adjusted the window size yet, but here's the screenshot: http://24.91.157.113/findyourdesire/journal-help.jpg ) has two javascript functions. it uses javascript to close the window upon reset. upon pushing the preview button it is suppossed to update the hidden iframe with the image (once i have that i'll add an "onChange" to get the mood image location to update automatically). i'm not good enough with javascript to understand what's going wrong right now, so if someone could explain that it'd be helpful.

the other javascript function it calls is supposed to update the page tht opened it. that doesn't work either, and once again, my understanding of javascript lacks to the point i don't understand what's wrong.

according to my understanding of javascript, the functions both get the information AND refer tot he correct elements in the respective forms.

the code for the window that gets opened (the iframe starts as a blank page)

note: while i have the domain name registered, it currently points nowhere and i expected a broken image when using the preview.

(pre-edited in the hopes it will remove horizontal scrolling)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>FindYourDesire.com -- Help With moods</title>
    <meta name="Author" content="Pages coded by Josh Perlmutter for
Desired Creations LLC">
    <meta name="Author" content="Graphics created by ? for Desired Creations LLC">
    <meta name="Author" content="Smileys created by ? for Desired Creations LLC">
    <style type="text/css">
      @import url(textStyle.css);
    </style>
  </head>

  <body>
    <p>This is to help find an internal image/mood combination. You may override
this with a mood or image of your own after choosing here</p>
    <form name="moodfind" onReset="window.close();" onSubmit="moodselector();">
      <table cellspacing="0" class="regnw">
  <tr>
    <td><select name="mood">
<option value="http://www.FindYourDesire.com/sitepics/smilies/angry.gif">angry</option>
<option value="http://www.FindYourDesire.com/sitepics/smilies/broken-hearted.gif">
broken-hearted</option><option
value="http://www.FindYourDesire.com/sitepics/smilies/love.gif">love</option>
</select></td>
    <td><input type="text" name="mil" value=""></td>

    <td><input type="button" onClick="prevImgUp();" value="Preview Image"></td>
  </tr>
  <tr>
    <td class="center"><input type="reset" value="I'll use my own"></td>
    <td class="center"><input type="submit" value="I wanna use these"></td>
    <td class="previmg"><iframe name="imgview"
src="/findyourdesire/help.php?disp=blank"></iframe></td>
  </tr>
      </table>
    </form>

    &lt;script language="Javascript"&gt;
function moodselector(){ // sets mood and mood image location
  var mood=document.moodfind.mood.value; // what is the mood?
  var mil='http://www.FindYourDesire.com/sitepics/smilies/'.mood.'gif';
// where is the image?

  window.opener(document.entry.mood=mood); // set the mood
  window.opener(document.entry.mil=mil); // set the mood image location
  window.self.close(); // close THIS window
}

function prevImgUp(){ // updates preview of mood image
  var mood=document.moodfind.mood.value; // what is the mood?
  var mil='http://www.FindYourDesire.com/sitepics/smilies/'.mood.'gif';
// where is the image?
  var newpg='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Mood Image Preview</title>
     <style type="text/css">
      @import url(textStyle.css);
    </style>
  </head>
  <body>
    <img src="'+mil+'" alt="'+mood+'">
  </body>
</html>'; // new image page

  document.moodfind.mil.value=mil; // set the image location

  window.imgview.document.open(); // open the iframe for witing
  window.imgview.document.write(newpg); // update the image
  window.imgview.document.close(); // close the iframe
}
    &lt;/script&gt;
      <p>&nbsp;
        <span class="pgcls">
  <br />Pages coded by Josh Perlmutter for Desired Creations LLC
  <br />Graphics created by ? for Desired Creations LLC
  <br />Smileys created by ? for Desired Creations LLC
  <br />All creations copyrighted by their respective Creators.
Reproduction Requires Consent of the Creator and Desired Creations LLC.
        </span>
      </p>
  </body>

</html>
'

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.