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) - <!-- start
-
function goNext() {
-
var currOffset = parseInt(parent.currTitle);
-
if (currOffset < 40) {
-
currOffset +=1;
-
parent.cryptogram.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c" + currOffset + ".html";
-
parent.keycode.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z" + currOffset + ".html";
-
} else {
-
alert("This is the last Cryptogram under this Image Theme.");
-
}
-
}
-
funtion goPrev() {
-
var currOffset = parseInt(parent.currTitle);
-
if (currOffset > 1) {
-
currOffset -= 1;
-
parent.cryptogram.location.href = "/gaming/2/word/cipher/f/c/c" + currOffset + ".html";
-
parent.keycode.location.href = "/gaming/2/word/cipher/f/z/z" + currOffset + ".html";
-
} else {
-
alert("This is the first Cryptogram under this Image Theme.");
-
}
-
}
-
// end -->
-
</script>
-
-
</head>
-
-
<body>
-
-
<div id="bgHolder">
-
</div>
-
-
-
<iframe name="cryptogram" frameborder="1" height="50" scrolling="auto" width="800"
-
src = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c1.html">
-
</iframe>
-
-
<iframe name="keycode" frameborder="1" height="60" scrolling="auto" width="800"
-
src = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z1.html">
-
</iframe>
-
-
-
<tr>
-
<td>
-
-
<a href="javascript:goPrev()">
-
<img src="http://www.tpgames.net/gaming/2/word/cipher/f/goprev.gif">
-
</a>
-
||
-
-
<a href="javascript:goNext()">
-
<img src="http://www.tpgames.net/gaming/2/word/cipher/f/gonext.gif">
-
</a>
-
The page that needs an onload event handler: Taken from c1 -
<body onload="currTitle()">
-
<table>
-
<tr><td class="tpmarble">
-
WMS KZLZECB RM YSPL RFC RMZQR.
-
</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 13 3590
Using - <body onload="goNext(); goPrev()">
didn't work either! Still nothing happened.
Lastly, I tried this: - <body onload="parent.currTitle.location='/gaming/2/word/cipher/f/2.html'">
Any questions, I'll post an answer in 10 hours or so.
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.
acoder 16,027
Recognized Expert Moderator MVP
Change the src of the iframe.
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. - 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 - ...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!
I was changing the onload event handler in the 2.html doc.
Changing the onload event handler on c1 and c2 to -
-
<body onload="parent.currTitle.location='/gaming/2/word/cipher/f/c/c1.html'">
Or having the link be to 2.html didn't work.
- <iframe name="cryptogram" frameborder="1" height="50" scrolling="auto" width="800"
-
src = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c1.html">
-
</iframe>
-
-
<iframe name="keycode" frameborder="1" height="60" scrolling="auto" width="800"
-
src = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z1.html">
-
</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!
The Current Set up of the pages:
2.html - <script type="text/javascript">
-
<!-- start
-
function goNext() {
-
var currOffset = parseInt(parent.currTitle);
-
if (currOffset < 40) {
-
currOffset +=1;
-
parent.cryptogram.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c" + currOffset + ".html";
-
parent.keycode.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z" + currOffset + ".html";
-
} else {
-
alert("This is the last Cryptogram under this Image Theme.");
-
}
-
}
-
function goPrev() {
-
var currOffset = parseInt(parent.currTitle);
-
if (currOffset > 1) {
-
currOffset -= 1;
-
parent.cryptogram.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c" + currOffset + ".html";
-
parent.keycode.location.href = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z" + currOffset + ".html";
-
} else {
-
alert("This is the first Cryptogram under this Image Theme.");
-
}
-
}
-
// end -->
-
</script>
-
-
</head>
-
-
<style>
-
-
#bgHolder {height:389px; width:494px; display:block; overflow:hidden;}
-
-
</style>
-
-
-
-
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
-
-
<!-- BODY ONLOAD CATASTROPHE -->
-
-
-
<body onload="parent.currTitle.location='http://www.tpgames.net/gaming/2/word/cipher/f/c/c1.html'">
-
-
-
<div id="bgHolder">
-
-
</div>
-
-
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
-
<!-- NOTE: Iframe! -->
-
-
-
-
-
<table>
-
<tr>
-
<td class="tpmarble" colspan="3">
-
-
<iframe name="cryptogram" frameborder="1" height="50" scrolling="auto" width="800"
-
src = "http://www.tpgames.net/gaming/2/word/cipher/f/c/c2.html">
-
</iframe>
-
-
-
<tr>
-
<td class="tpmarble" colspan="3">
-
-
<iframe name="keycode" frameborder="1" height="60" scrolling="auto" width="800"
-
src = "http://www.tpgames.net/gaming/2/word/cipher/f/z/z2.html">
-
</iframe>
-
-
-
<tr>
-
<td class="tpmarble" colspan="3">
-
<a href="http://www.tpgames.net/gaming/2/word/cipher.html">
-
Cryptology Nav </a>
-
-
||
-
-
<a href="javascript:goPrev()">
-
<img src="http://www.tpgames.net/gaming/2/word/cipher/f/goprev.gif">
-
</a>
-
-
||
-
-
<a href="javascript:goNext()">
-
<img src="http://www.tpgames.net/gaming/2/word/cipher/f/gonext.gif">
-
</a>
I used the following body onload tags in c1 and c2.
Body onload tag 1 with c1 content: - <body onload="parent.currTitle.location='/gaming/2/word/cipher/f/c/c1.html'">
-
-
<table>
-
<tr><td class="tpmarble">
-
-
WMS KZLZECB RM YSPL RFC RMZQR.
Body onload trial 2 with c2 content: - <body onload="parent.currTitle.location='/gaming/2/word/cipher/f/2.html'">
-
<table>
-
<tr><td class="tpmarble">
-
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!
Happy Easter! Now that everyone is full on celebrations, is there anyone online for JS help?
Thanks!
Bump...
Sign in to post your reply or Sign up for a free account.
Similar topics |
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?
|
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;
|
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
|
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.
...
|
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">
<!--
| |
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...
|
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?
|
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.
|
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...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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();...
|
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
| |
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...
| |