Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Help - Showing Hidden Span on Submit?

    Hi

    I've been trying to use javascript to show a hidden span containing instructions when a form is submitted with no luck so far..

    Basically when the form is submitted, onclick should run a couple of functions, one sets the button text to read something else and the other should show instructions hidden in a span with style="display:none".

    The button is renamed on clicking, but I cannot get the hidden span to show up. What am I doing wrong? I've tried various things including trying to get function remoteConnect() to unhide the span or getting it to run function showSpan(answer1)..

    Button:-
    Code:
    <input name="submit" type='submit' class="connectbutton" style="border: 1px groove rgb(0, 0, 0); text-align: center; background-color:#FFCC00; width:200px" value='Connect to Support' onclick="remoteConnect(); showSpan('answer1'); return false;" />
    Javascript:-
    Code:
    <script language="JavaScript">
    function remoteConnect() {
    document.channel296606886.submit.value = 'Loading.. Please wait..';
    document.channel296606886.submit();
    }
    </script>
    
    <script language="JavaScript">
    function showSpan(id) {
    document.getElementById(id).style.display = 'block';
    }
    </script>
    Hidden Span:-
    Code:
    <span id="answer1" style="display:none">
    <p class="boxontop style15 style16 style17">Select 'Open' followed by 'Run' when prompted</p>
    </span>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    onclick="remoteConnect(); showSpan('answer1'); return false;"
    function remoteConnect() {
    document.channel296606886.submit.value = 'Loading.. Please wait..';
    document.channel296606886.submit();
    }
    Since the first function has a submit() call, the script losses its control before calling the showSpan()

    BTW, you might have some error in your current script with
    <input name="submit"
    and
    document.channel296606886.submit();
    Last edited by abduraooft; 10-05-2008 at 04:42 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    bridgey (10-05-2008)

  • #3
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks - works great now


  •  

    Posting Permissions

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