Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2007, 10:56 PM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I get a keypress to open this other iframe?

So I have this code:

<script language="JavaScript">
var cheatCode = "all your base are belong to us".toUpperCase();
var codeIndex = 0;

function executeCheat() {
    alert("h4x3d!!!1!11");
    }

function codeHandler(e) {
    if(!e) e = window.event;
    var k = e.keyCode? e.keyCode: e.which;
    if(!(k==cheatCode.charCodeAt(codeIndex++))) {
        codeIndex = 0;
        return;
        }
    else if(codeIndex==cheatCode.length) executeCheat();
    }

document.addEventListener? document.addEventListener("keydown", codeHandler, false): document.attachEvent("onkeydown", codeHandler);
</script>

But instead of it opening the alert, I want it to open a iframe:

<a href="example.jpg" rel="lightbox[1337]" title="h4x3d!!!1!11">all your base are belong to us</a>

But this is not a ordinary iframe. It doesn't have a separate url, so I couldn't place a script code in the parent url:

http://www.dynamicdrive.com/dynamici...box2/index.htm

So what do I do?

 
Old July 9th, 2007, 05:20 AM
Friend of Wrox
 
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:
But instead of it opening the alert, I want it to open a iframe:

<a href="example.jpg" rel="lightbox[1337]" title="h4x3d!!!1!11">all your base are belong to us</a>
I didn't get this line. That code is not a iframe at all its just a link. I know how you can show a iframe when you click something but is this really what you want?

__________________________________________________ ________
I am DJ Kat...that's my name. Its a D and a J and a Kat with a K.
 
Old July 9th, 2007, 05:22 AM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, it's not a link either. If you check the demo:

http://www.dynamicdrive.com/dynamici...box2/index.htm

The link doesnt open into a new window or the parent window, but instead a weird iframe thingie, that i dont know another name for.






Similar Threads
Thread Thread Starter Forum Replies Last Post
keypress umeshtheone Beginning VB 6 0 June 9th, 2007 12:38 AM
values from one iframe to another iframe URGENT raaj Beginning PHP 2 February 27th, 2007 12:19 PM
on KeyPress Help higgo23 Access VBA 3 October 5th, 2006 07:08 AM
keypress event kau_shuk VB.NET 2002/2003 Basics 1 July 31st, 2006 11:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.