SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    ::==:: Bonzo_CS's Avatar
    Join Date
    Dec 2003
    Location
    (Cardiff Wales)
    Posts
    747
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post new window (pop up)

    Hi all,

    a really easy question I'm sure.

    I want to create a link (rules) on a site. When clicked I would like a pop up/new window to open just containing a paragraph of information. I tried a few tutorials , but am not getting much joy.

    I tried the following but it stating error on page?


    <a href="#" onClick="MM_openBrWindow('customer/rules.htm','','scrollbars=yes,width=414,height=200')">Rules</a>
    Any help appreciated

    Craig
    Last edited by Bonzo_CS; Mar 19, 2004 at 08:18.

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Maryland, USA
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The following is the main page.

    Code:
    <HTML>
    <HEAD>
    	<TITLE>Rules</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    function MM_openBrWindow( rule_ )
    {
        // Replacing the value of the hidden variable (ruleInfo) with what is passed in from clicking the link.
        document.ruleForm.ruleInfo.value = rule_;
    
        // I am assuming that the child window (rule.htm) is the same size for all rules.
        window.open( "customer/rules.htm", "", "scrollbars=yes,width=414,height=200" );
    }
    </SCRIPT>
    </HEAD>
    
    <BODY>
    <FORM NAME="ruleForm">
        <!-- All the rules are passed in to MM_openBrWindow as a variable. -->
        <A HREF="#" onClick="MM_openBrWindow('This is the first rule I want in the child window')">Rule 1</A><BR>
        <A HREF="#" onClick="MM_openBrWindow('Rule 2: .....')">Rule 2</A>
        <!-- HIDDEN VARIABLE -->
        <INPUT TYPE="hidden" NAME="ruleInfo">
    </FORM>
    </BODY>
    </HTML>
    This is rule.htm that will display your rule.

    Code:
    <HTML>
    <HEAD>
    	<TITLE>Rule</TITLE>
    </HEAD>
    
    <BODY>
    <SCRIPT LANGUAGE="JavaScript">
        // Get the rule from the hidden variable (ruleInfo) of the parent window.
        document.write( self.opener.ruleForm.ruleInfo.value );
    </SCRIPT>
    </BODY>
    </HTML>

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is awfully cute.

    Others on that site, and here.
    ::: certified wild guess :::

  4. #4
    ::==:: Bonzo_CS's Avatar
    Join Date
    Dec 2003
    Location
    (Cardiff Wales)
    Posts
    747
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cheers guys

    Hey thanks guys much appreciated!


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
  •