SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How would I get this keypress to open up this different iframe?

    Upon pressing a certain keycode, I want something to pop up.

    PHP 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(!
    ewindow.event;
        var 
    e.keyCodee.keyCodee.which;    
        if(!(
    k==cheatCode.charCodeAt(codeIndex++))) {
            
    codeIndex 0;
            return;
            }
        else if(
    codeIndex==cheatCode.lengthexecuteCheat();
        }

    document.addEventListenerdocument.addEventListener("keydown",
     
    codeHandlerfalse): document.attachEvent("onkeydown"codeHandler);
    </script> 
    But instead of it opening the alert, I want it to open a iframe:

    PHP Code:
    <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?

  2. #2
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey

    check this out
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> Iframe example</TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="Vikrant Korde">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    <iframe name="test" src="http://www.google.com" width="300" height="300" border="1"> </iframe>
    <button value="test" onclick="window.open('http://moronkreacionz.com/', 'test', '');">
    <BODY>
    
    </BODY>
    </HTML>
    Check the variable test. It is the name of the iframe and window.open is also using that as the target for new window.
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  3. #3
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I don't need a button to open this iframe. I got this code that lets you click something on the keyboard and it'll open up. The code:

    PHP Code:
    onclick="window.open('http://moronkreacionz.com/', 'test', '');" 
    won't work, but something like

    PHP Code:
    iheartpotwin=dhtmlwindow.open(
    "example.swf" rel="lightbox" title="h4x3d!!!1!11"); 
    would work. Does that help? I don't understand how that code can help me

  4. #4
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dude,

    that was an example. it is a code that you can use it anywhere.
    i can't test it here. so theoretically this should work
    window.open('example.swf', 'test', '');


    this will open the swf file in the iframe.
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  5. #5
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh ok, thanks dude, but what about the:

    PHP Code:
    rel="lightbox[1337]" 

  6. #6
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure what is that for. Is that related to the FLASH
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  7. #7
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's related to the lightbox script here:

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

  8. #8
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have seen the link.
    you can still try giving that. never worked with rel attribute. will try and tell u if i find it.
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  9. #9
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got it kinda to work, but I'm still gotta finish tweeking it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •