...

View Full Version : Help - Showing Hidden Span on Submit?



bridgey
10-05-2008, 02:32 PM
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:-

<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:-

<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:-

<span id="answer1" style="display:none">
<p class="boxontop style15 style16 style17">Select 'Open' followed by 'Run' when prompted</p>
</span>

abduraooft
10-05-2008, 03:18 PM
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();

bridgey
10-05-2008, 04:39 PM
Thanks - works great now :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum