/    Sign up×
Community /Pin to ProfileBookmark

Ns4.08/4.77/4.79

The following code works fine in IE5.0,IE6.0 and NS6.2.3. But, it doesn’t work in NS4.08/4.77/4.79. Could you please help? Thanks.

<form name=”CHActivation” method=”post”>

<script language=”javascript”>
function DisableNext()
{
document.CHActivation.action=”<cfoutput>#VisaApp.FullURL##XFA.EnrollThanks#&RequestTimeOut=500</cfoutput>”;
document.CHActivation.submit();

document.getElementById(‘NextBtn’).disabled = true;
document.getElementById(‘NextBtn’).src=”<cfoutput>#VisaApp.Images#</cfoutput>btn_next_off.gif”;

document.getElementById(‘BackBtn’).disabled = true;
document.getElementById(‘BackBtn’).src=”<cfoutput>#VisaApp.Images#</cfoutput>btn_back_off.gif”;
}

function DisableBack()
{
document.CHActivation.action=”<cfoutput>#VisaApp.FullURL##XFA.TsAndCsAccept#</cfoutput>”;
document.CHActivation.submit();

document.getElementById(‘NextBtn’).disabled = true;
document.getElementById(‘NextBtn’).src=”<cfoutput>#VisaApp.Images#</cfoutput>btn_next_off.gif”;

document.getElementById(‘BackBtn’).disabled = true;
document.getElementById(‘BackBtn’).src=”<cfoutput>#VisaApp.Images#</cfoutput>btn_back_off.gif”;
}

</script>

<input type=”image” name=”NextBtn” src=”<cfoutput>#VisaApp.Images#</cfoutput>btn_next.gif” id=”NextBtn” alt=”Next button” title=”Next button” height=”17″ width=”40″ border=”0″ onclick=”DisableNext()”>

<p><input name=”BackBtn” type=”image” src=”<cfoutput>#VisaApp.Images#</cfoutput>btn_back.gif” id=”BackBtn” alt=”Back button” title=”Back button” height=”17″ width=”40″ border=”0″ onclick=”DisableBack()”></p>

</form>

to post a comment
JavaScript

12 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJun 16.2003 — Can you be more specific that what you expect your code to be doing which its not doing and the errors you get...for NS<5
Copy linkTweet thisAlerts:
@mraghuauthorJun 16.2003 — When the user clicks on the "Next" or "Back" Image, I want to disable the Next(btn_next.gif) and Back(btn_back.gif) Images and show the greyed out Next(btn_next_off.gif) and Back(btn_back_off.gif) images so as to prevent multiple clicks.

This is working fine in IE5.0,6.0 and NS6.2.3. It neither disables nor shows the greyed out gifs in NS4 browsers. Could you please help? Thanks.
Copy linkTweet thisAlerts:
@pyroJun 16.2003 — It doesn't work because getElementById does not work in NN 4.x
Copy linkTweet thisAlerts:
@mraghuauthorJun 16.2003 — Thanks for getting back. What alternate code can I use to make the same functionality work in all browser versions?
Copy linkTweet thisAlerts:
@pyroJun 16.2003 — It looks like they are form fields, so you can reference them like this:

document.formname.fieldname
Copy linkTweet thisAlerts:
@mraghuauthorJun 16.2003 — Based on your hint, I tried using the following code.

I am getting "document.CHActivation.NextBtn" is null or not an object" How do I fix that?

<form name="CHActivation" method="post">

<script language="javascript">

function DisableNext()

{

document.CHActivation.action="<cfoutput>#VisaApp.FullURL##XFA.EnrollThanks#&RequestTimeOut=500</cfoutput>";

document.CHActivation.submit();

document.CHActivation.NextBtn.disabled=true;

document.CHActivation.NextBtn.src="<cfoutput>#VisaApp.Images#</cfoutput>btn_next_off.gif";

document.CHActivation.BackBtn.disabled=true;

document.CHActivation.BackBtn.src="<cfoutput>#VisaApp.Images#</cfoutput>btn_back_off.gif";

}

function DisableBack()

{

document.CHActivation.action="<cfoutput>#VisaApp.FullURL##XFA.TsAndCsAccept#</cfoutput>";

document.CHActivation.submit();

document.CHActivation.NextBtn.disabled=true;

document.CHActivation.NextBtn.src="<cfoutput>#VisaApp.Images#</cfoutput>btn_next_off.gif";

document.CHActivation.BackBtn.disabled=true;

document.CHActivation.BackBtn.src="<cfoutput>#VisaApp.Images#</cfoutput>btn_back_off.gif";

}

</script>


<input type="image" name="NextBtn" src="<cfoutput>#VisaApp.Images#</cfoutput>btn_next.gif" id="NextBtn" alt="Next button" title="Next button" height="17" width="40" border="0" onclick="DisableNext()">

<p><input name="BackBtn" type="image" src="<cfoutput>#VisaApp.Images#</cfoutput>btn_back.gif" id="BackBtn" alt="Back button" title="Back button" height="17" width="40" border="0" onclick="DisableBack()"></p>

</form>
Copy linkTweet thisAlerts:
@Khalid_AliJun 17.2003 — Honestly..I don't understand why and what is it exactly you are trying to do.Unlss you have a link where I can see what you said is working code for IE and NS6+.

anyways...by looking at your code the correct syntax for doing he exact samething in NS<5 is following

if(document.layers){

document.CHActivation.BackBtn.disabled = false;

document.CHActivation.NextBtn.disabled = true;

}else{

document.getElementById('NextBtn').disabled = true;

document.getElementById('NextBtn').src="images/button2b.gif";

document.getElementById('BackBtn').disabled = false;
document.getElementById('BackBtn').src="images/button1b.gif";

}
Copy linkTweet thisAlerts:
@mraghuauthorJun 17.2003 — Thanks for getting back. I will try your solution and see how it works in NS<5 versions. Thanks.
Copy linkTweet thisAlerts:
@mraghuauthorJun 17.2003 — Nope. Usage of layers didn't disable the Next and Prev Images in NS<5.
Copy linkTweet thisAlerts:
@gil_davisJun 17.2003 — NS 4.x does not support "disabled" for form elements. However, the way your code is written, it will create one for you, then you have to explicitly test it. For example:
function DisableNext() {
if (!document.CHActivation.NextBtn.disabled)
{ // do the function }
if (!document.CHActivation.BackBtn.disabled)
{ // do the function }
}

Notice that it doesn't matter whether the "disabled" part has been created or not because if it does not exist, the compare is false.
Copy linkTweet thisAlerts:
@mraghuauthorJun 17.2003 — The purpose of my function itself is to diable the "btn_next.gif" & "btn_back.gif" images as soon as the user clicks on any one of them and to show the greyed out "btn_next_off.gif" & "btn_back_off.gif "instead. How do you transform the code below as per your logic?


function DisableNext()

{

document.CHActivation.action="<cfoutput>#VisaApp.FullURL##XFA.EnrollThanks#&RequestTimeOut=500</cfoutput>";

document.CHActivation.submit();

document.getElementById('NextBtn').disabled = true;

document.getElementById('NextBtn').src="<cfoutput>#VisaApp.Images#</cfoutput>btn_next_off.gif";

document.getElementById('BackBtn').disabled = true;

document.getElementById('BackBtn').src="<cfoutput>#VisaApp.Images#</cfoutput>btn_back_off.gif";

}
Copy linkTweet thisAlerts:
@gil_davisJun 18.2003 — You must not have read khalid's post about getElementById() - that NS 4.x does not support it.
function DisableNext() {
if (!document.CHActiveation.NextBtn.disabled)
{document.CHActivation.action="&lt;cfoutput&gt;#VisaApp.FullURL##XFA.EnrollThanks#&amp;RequestTimeOut=500&lt;/cfoutput&gt;";
document.CHActivation.submit();
document.CHActivation.NextBtn.disabled = true;
document.CHActivation.NextBtn.src="&lt;cfoutput&gt;#VisaApp.Images#&lt;/cfoutput&gt;btn_next_off.gif";
document.CHActivation.BackBtn.disabled = true;
document.CHActivation.BackBtn.src="&lt;cfoutput&gt;#VisaApp.Images#&lt;/cfoutput&gt;btn_back_off.gif";
}
}
BTW, NS 4.x does not support onClick for an input type="image", anyway. See http://devedge.netscape.com/library/manuals/1998/htmlguide/tags10.html#1312530 . In fact, the image button does not appear in the form's elements array. So, even my example will not work in NS 4.x. You'll have to change the <input type="image"> to a simple image link with an onclick that submits the form for you, if you want it to work in NS 4.x.
×

Success!

Help @mraghu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...