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 3546
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.
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...
- <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!
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!
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.
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.
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.
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...
|
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>...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
| |