473,715 Members | 6,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

tpgames
785 Contributor
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 3590
tpgames
785 Contributor
Using
Expand|Select|Wrap|Line Numbers
  1. <body onload="goNext(); goPrev()">
didn't work either! Still nothing happened.
Apr 3 '07 #2
tpgames
785 Contributor
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 Contributor
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 Recognized Expert Moderator MVP
Change the src of the iframe.
Apr 5 '07 #5
tpgames
785 Contributor
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 Contributor
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 Contributor
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 Contributor
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 Contributor
Happy Easter! Now that everyone is full on celebrations, is there anyone online for JS help?
Thanks!
Bump...
Apr 10 '07 #10

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

Similar topics

6
4575
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 to tell if the window.onload event has already fired. I cannot edit the onload event handler itself, and my function can only exist in an external js file, sourced from the document's head section. Any ideas?
3
1803
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> function togglePurDec(evt) { evt = (evt) ? evt : event; var target = (evt.target) ? evt.target : evt.srcElement;
14
2218
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, right?? I also put a test alert, but alert does not come up if file I'm testing for is loaded in 'main' frame.. thank you.. Frances
1
11576
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
9
1503
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 is wrong with this? Thank you! <html> <head> <script language="JavaScript"> <!--
3
26755
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 in firefox. The onload method I assign is never being called. Any ideas why firefox isn't calling this, or what I can do for a workaround? Below is approxiatemate code of what I'm doing...
7
1733
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 calling function detects different HTML elements?! for the first one (below) it sees it as <IMGbut the second one is seen as <AWhy?
6
19292
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 know, this shouldn't be an issue, but I just can't get it to work. The script only needs to work with Firefox/Mozilla, so XP code isn't an issue. I have tried to open a window like so.
7
3157
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 load, an image.onload handler I've previously assigned will be called. Or should be at any rate. The problem is that I need to know inside the onload handler which particular image in the array invoked the handler. I'd be quite happy to know...
0
8821
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8718
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9340
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9196
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9047
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6646
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5967
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3175
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2118
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.