Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-05-2008, 02:32 PM   PM User | #1
bridgey
New to the CF scene

 
Join Date: Dec 2004
Posts: 8
Thanks: 3
Thanked 0 Times in 0 Posts
bridgey is an unknown quantity at this point
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>
bridgey is offline   Reply With Quote
Old 10-05-2008, 03:18 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
onclick="remoteConnect(); showSpan('answer1'); return false;"
Quote:
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
Quote:
<input name="submit"
and
Quote:
document.channel296606886.submit();
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

Last edited by abduraooft; 10-05-2008 at 04:42 PM..
abduraooft is offline   Reply With Quote
Users who have thanked abduraooft for this post:
bridgey (10-05-2008)
Old 10-05-2008, 04:39 PM   PM User | #3
bridgey
New to the CF scene

 
Join Date: Dec 2004
Posts: 8
Thanks: 3
Thanked 0 Times in 0 Posts
bridgey is an unknown quantity at this point
Thanks - works great now
bridgey is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:22 AM.


Advertisement
Log in to turn off these ads.