Question for Code Gurus

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 2MuchMark
    Mark of 2Much.net
    • Aug 2004
    • 50973

    #1

    Question for Code Gurus

    Question for Code Gurus

    I want to add a link from Site A to Site B, where Site B has a link with an onclick attribute. For example:

    Site B has a welcome page. The welcome page contains this link:
    <a href="javascript:void(0);" onclick="openLoginModal()">Login</a>

    I want to create a link from site A, to the welcome page of site B, but that automatically opens the LoginModal as onclick.

    I tried something like this:

    <a href = "https://example.com" onclick="openLoginModal()">Click here</a>

    But it doesn't work.

    Any help is appreciated. Thanks!
  • k0nr4d
    Confirmed User
    • Aug 2006
    • 9231

    #2
    Simplest way is like this:

    Link to https://siteb.com/?modal=true
    and then on siteb page

    <?php if($_GET['modal']) { ?>
    <script>
    openLoginModal();
    </script>
    <? } ?>

    If it's a smarty template you have to do it with JS
    Mechanical Bunny Media
    Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

    Comment

    • AzteK
      Confirmed User
      • Feb 2001
      • 3451

      #3
      This doesn't make any sense to me. Why would a link invoke the modal on the welcome page? The destination page should execute it...

      Comment

      • k0nr4d
        Confirmed User
        • Aug 2006
        • 9231

        #4
        Originally posted by AzteK
        This doesn't make any sense to me. Why would a link invoke the modal on the welcome page? The destination page should execute it...
        While that is what he wants to do, he's thinking about it the wron gway. He needs to invoke the modal without pressing the button when linking from the other page, not invoke the modal from site A
        Mechanical Bunny Media
        Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

        Comment

        Working...