473,407 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

What is the onload event handler needed to get # assigned to parent variable?

tpgames
785 512MB
What is the onload event handler needed to get # assigned to parent variable? What I tried didn't work!
Code is from JS bible, page 127-8 with some minor alterations by me.
Parent Page (in part)
Expand|Select|Wrap|Line Numbers
  1. <!-- start
  2. function goNext() {
  3. var currOffset = parseInt(parent.currTitle);
  4. if (currOffset < 40) {
  5.     currOffset +=1;
  6.     parent.cryptogram.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c" + currOffset + ".html";
  7.     parent.keycode.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z" + currOffset + ".html";
  8. } else {
  9.     alert("This is the last Cryptogram under this Image Theme.");
  10.     }
  11. }
  12. funtion goPrev() {
  13.     var currOffset = parseInt(parent.currTitle);
  14.     if (currOffset > 1) {
  15.         currOffset -= 1;
  16.         parent.cryptogram.location.href = "/gaming/2/word/cipher/f/c/c" + currOffset + ".html";
  17.         parent.keycode.location.href = "/gaming/2/word/cipher/f/z/z" + currOffset + ".html";
  18. } else {
  19.     alert("This is the first Cryptogram under this Image Theme.");
  20.     }
  21. }
  22. // end -->
  23. </script>
  24.  
  25. </head>
  26.  
  27. <body>
  28.  
  29. <div id="bgHolder">
  30. </div>
  31.  
  32.  
  33. <iframe name="cryptogram" frameborder="1" height="50" scrolling="auto" width="800" 
  34. src = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c1.html">
  35. </iframe>
  36.  
  37. <iframe name="keycode" frameborder="1" height="60" scrolling="auto" width="800" 
  38. src = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z1.html">
  39. </iframe>
  40.  
  41.  
  42. <tr>
  43. <td>
  44.  
  45. <a href="javascript:goPrev()">
  46. <img src="http://www.tpgames.net/gaming/2/word/cipher/f/goprev.gif">
  47. </a>
  48. ||
  49.  
  50. <a href="javascript:goNext()">
  51. <img src="http://www.tpgames.net/gaming/2/word/cipher/f/gonext.gif">
  52. </a>
  53.  
The page that needs an onload event handler: Taken from c1
Expand|Select|Wrap|Line Numbers
  1. <body onload="currTitle()">
  2. <table>
  3. <tr><td class="tpmarble">
  4. WMS KZLZECB RM YSPL RFC RMZQR.
  5. </table>
The onload = bit didn't work. I don't want the next page in the frame to come up until the user clicks on goNext. When I click on goNext, nothing happens.
Thanks!

The Parent Page
page c1
page z1
page c2
page z2
Apr 3 '07 #1
13 3546
tpgames
785 512MB
Using
Expand|Select|Wrap|Line Numbers
  1. <body onload="goNext(); goPrev()">
didn't work either! Still nothing happened.
Apr 3 '07 #2
tpgames
785 512MB
Lastly, I tried this:
Expand|Select|Wrap|Line Numbers
  1. <body onload="parent.currTitle.location='/gaming/2/word/cipher/f/2.html'">
Any questions, I'll post an answer in 10 hours or so.
Apr 3 '07 #3
tpgames
785 512MB
I've been trying to research and find an answer, but not understanding what I've read yet. And, no one has had the time yet to read this. So, will check back on Friday.
Apr 4 '07 #4
acoder
16,027 Expert Mod 8TB
Change the src of the iframe.
Apr 5 '07 #5
tpgames
785 512MB
Change the src of the iframe.
Excuse the denseness of my brain, but what would I change the src too?
Changing the body onload url to c1.html gives me the alert boxes but doesn't give me c2.html.
Expand|Select|Wrap|Line Numbers
  1. body onload="parent.currTitle.location='/gaming/2/word/cipher/f/c/c1.html'">
If I change it to c2.html, then the user doesn't get to do c1.html first. If I change it to 3.html, one doesn't get the correct page at all. The currOffset is suppose to be the page number the
Expand|Select|Wrap|Line Numbers
  1. ...cipher/f/c/c" + currOffset + ".html";
and is suppose to give me the url folders + file name c + number attached to file name + .html.
Thanks!
Apr 5 '07 #6
tpgames
785 512MB
I was changing the onload event handler in the 2.html doc.
Changing the onload event handler on c1 and c2 to
Expand|Select|Wrap|Line Numbers
  1.  
  2. <body onload="parent.currTitle.location='/gaming/2/word/cipher/f/c/c1.html'">
Or having the link be to 2.html didn't work.
Apr 5 '07 #7
tpgames
785 512MB
Expand|Select|Wrap|Line Numbers
  1. <iframe name="cryptogram" frameborder="1" height="50" scrolling="auto" width="800" 
  2. src = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c1.html">
  3. </iframe>
  4.  
  5. <iframe name="keycode" frameborder="1" height="60" scrolling="auto" width="800" 
  6. src = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z1.html">
  7. </iframe>
The iframe links are to the exact page that the user should see first. I don't understand what they should link too. I'm suppose to be able to change the frame content without having to change the entire page.
Thanks!
Apr 5 '07 #8
tpgames
785 512MB
The Current Set up of the pages:
2.html
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!-- start
  3. function goNext() {
  4. var currOffset = parseInt(parent.currTitle);
  5. if (currOffset < 40) {
  6.     currOffset +=1;
  7.     parent.cryptogram.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c" + currOffset + ".html";
  8.     parent.keycode.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z" + currOffset + ".html";
  9. } else {
  10.     alert("This is the last Cryptogram under this Image Theme.");
  11.     }
  12. }
  13. function goPrev() {
  14.     var currOffset = parseInt(parent.currTitle);
  15.     if (currOffset > 1) {
  16.         currOffset -= 1;
  17.         parent.cryptogram.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c" + currOffset + ".html";
  18.         parent.keycode.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z" + currOffset + ".html";
  19. } else {
  20.     alert("This is the first Cryptogram under this Image Theme.");
  21.     }
  22. }
  23. // end -->
  24. </script>
  25.  
  26. </head>
  27.  
  28. <style>
  29.  
  30. #bgHolder {height:389px; width:494px; display:block; overflow:hidden;}
  31.  
  32. </style>
  33.  
  34.  
  35.  
  36. <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
  37.  
  38. <!-- BODY ONLOAD CATASTROPHE -->
  39.  
  40.  
  41. <body onload="parent.currTitle.location='http://www.tpgames.net/gaming/2/word/cipher/f/c/c1.html'">
  42.  
  43.  
  44. <div id="bgHolder">
  45.  
  46. </div>
  47.  
  48. <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
  49. <!-- NOTE: Iframe! -->
  50.  
  51.  
  52.  
  53.  
  54. <table>
  55. <tr>
  56. <td class="tpmarble" colspan="3">
  57.  
  58. <iframe name="cryptogram" frameborder="1" height="50" scrolling="auto" width="800" 
  59. src = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c2.html">
  60. </iframe>
  61.  
  62.  
  63. <tr>
  64. <td class="tpmarble" colspan="3">
  65.  
  66. <iframe name="keycode" frameborder="1" height="60" scrolling="auto" width="800" 
  67. src = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z2.html">
  68. </iframe>
  69.  
  70.  
  71. <tr>
  72. <td class="tpmarble" colspan="3">
  73. <a href="http://www.tpgames.net/gaming/2/word/cipher.html">
  74. Cryptology Nav </a>
  75.  
  76. &nbsp; &nbsp; || &nbsp; &nbsp;
  77.  
  78. <a href="javascript:goPrev()">
  79. <img src="http://www.tpgames.net/gaming/2/word/cipher/f/goprev.gif">
  80. </a>
  81.  
  82. &nbsp; &nbsp; || &nbsp; &nbsp;
  83.  
  84. <a href="javascript:goNext()">
  85. <img src="http://www.tpgames.net/gaming/2/word/cipher/f/gonext.gif">
  86. </a>
I used the following body onload tags in c1 and c2.
Body onload tag 1 with c1 content:
Expand|Select|Wrap|Line Numbers
  1. <body onload="parent.currTitle.location='/gaming/2/word/cipher/f/c/c1.html'">
  2.  
  3. <table>
  4. <tr><td class="tpmarble">
  5.  
  6. WMS KZLZECB RM YSPL RFC RMZQR.

Body onload trial 2 with c2 content:
Expand|Select|Wrap|Line Numbers
  1. <body onload="parent.currTitle.location='/gaming/2/word/cipher/f/2.html'">
  2. <table>
  3. <tr><td class="tpmarble">
  4. DEQD GQS BKD DEFJF LN CLOEDLSO CBJ NBGFDELSO EF XFVLFYFN LS, VLAF HBJVP ZFQIF!
The errors I receive:
This is the first cryptogram under this theme.
This is the last cryptogram under this theme.
But, I never get page c2 and z2 (the helper file) to load.
Thanks!
Apr 6 '07 #9
tpgames
785 512MB
Happy Easter! Now that everyone is full on celebrations, is there anyone online for JS help?
Thanks!
Bump...
Apr 10 '07 #10
tpgames
785 512MB
Expand|Select|Wrap|Line Numbers
  1. <iframe name="cryptogram" frameborder="1" height="50" scrolling="auto" width="800" 
  2. src = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c1.html">
  3. </iframe>
  4.  
  5. <iframe name="keycode" frameborder="1" height="60" scrolling="auto" width="800" 
  6. src = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z1.html">
  7. </iframe>
The iframe links are to the exact page that the user should see first. I don't understand what they should link too. I'm suppose to be able to change the frame content without having to change the entire page.
Thanks!
Anyone have any clues? I appreciate the answer "change the src of the iFrame" but I don't understand what I'm suppose to change it too.
Thanks!
Apr 12 '07 #11
acoder
16,027 Expert Mod 8TB
For accessing iframes, see link.

You have not defined goNext() properly, hence the errors. You can't parse the iframe object and get a number.
Apr 13 '07 #12
tpgames
785 512MB
Sorry, but I've read and reread that page several times, did lots of research and didn't understand it. Why I've not posted back until now. He is not trying to get 2 frames to move using only 1 button. I have yet to understand anything at the quirksmode site. It not them, its me.

According to the JavaScript bible, one can indeed have 2 frames that change their content according to 1 link. Most of the code originated from that book. However, I can NOT figure out how to change their code to my purposes. I am ready to give up!
No one on the web even does what I am attempting to do! I am going to attempt to email the author and see if he can figure out what the beep I am doing wrong! He has a 'help file' that loads on the bottom frame, and a 'normal page' that loads in the top frame, and the navigation frame on the left. Which is where my code is different. I don't have navigation on the left, it on the very bottom. Plus, I have a rotating image thingy on the top left. I'm just trying to get the code to move 2 frames forward 1 notch with each click of the button. If I were to use a link array, how would one get the contents of that link to show up? showArray doesn't work. BuildArray won't work.
It would probably be easier if I were to just learn how to write the silly cipher game in JS to begin with, instead of trying to use HTML and only use JS to move the silly pages in the frames. Then again maybe not, as I am a complete idiot when it comes to understanding JavaScript!
Sorry for rambling. I've had a headache for 4 days and trying to understand this at the same time. Not working. Thanks.
Apr 16 '07 #13
tpgames
785 512MB
I found a different code that works better. I'm just going to have the z1 page in a frame on the c1page. They will have to click on a series of links they want. I'm just not getting JavaScript yet and link structure and all. :>)

Thanks for trying to help me!
This case closed.
Apr 17 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Brian | last post by:
Hi everyone, I'm writing a function (in javascript) that needs to do one thing if the page has not loaded, and another (different) thing if the page has already loaded. I'm looking for a way...
3
by: Brett | last post by:
What is the following code doing? I see evt and event but what is the difference? <input type="radio" id="us_countryFlag1" name="us_country" onclick="togglePurDec(event)">Yes <script>...
14
by: Frances Del Rio | last post by:
if (parent.frames.main.location == 'mediaselect.html') { I have a very simple frameset, name of frame where I'm checking is 'main'... why is this not working? I mean this is correct syntax,...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
9
by: killermookie | last post by:
I'm not a javascripter so this is slightly unfamiliar to me. What I'm trying to do is that if someone clicks the radio button for Other, then the text input for other will become enabled. What...
3
by: jon | last post by:
Hello, I've had long standing code that runs in IE, that I'm testing with firefox unsuccessfully now. The problem seems to be that images that I dynamically create don't fire their onload event...
7
by: amit | last post by:
Hello everybody, I need your advice on this. In my javascript I'm using two anchor <A> which both are to download a pdf file. That works fine but my question is why the "this" parameter in...
6
by: Daz | last post by:
Hello everyone, I would like to open a child window from the parent, and add an onload event listener to the child window which will tell the parent when the document has loaded. As far as I...
7
by: howardk | last post by:
I'm writing some code that loads a number of images, using the standard mechanism of assigning a src url to a newly constructed Image object, thus invoking the image-load operation. On a successful...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.