/    Sign up×
Community /Pin to ProfileBookmark

Netscape Problem

I have some javascript code (see below) that works with IE but with Netscape it resets the values but then processes the whole page after resetting. IE doesn’t process anymore of the page. Can someone help me with figuring out what to put in here to keep Netscape from processing the rest of my page after it resets? The main function is VerifyData. The other two are used by VerifyData.

Thanks,

Rick

function VerifyData(frmRank)
{
if (document.frmRank.rank1.value > document.frmRank.rank2.value)
{
alert (“The first ranking number must be less than or equal to the “
+”second ranking number – please reenter”);
cursorRank()
return (false);
}
if (document.frmRank.rank1.value > 30)
{
alert (“The first ranking number must be less than or equal to 30.”);
cursorRank()
return (false);
}
if (document.frmRank.rank2.value > 30)
{
alert (“The second ranking number must be less than or equal to 30.”);
cursorRank()
return (false);
}
return true
}

function cursorRank()
{
CtrlUser = document.frmRank.rank1
reset();
CtrlUser.focus();
}

function reset()
{
frmRank.rank1.value = “1”;
frmRank.rank2.value = “4”;
}

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisFeb 16.2004 — Please post a link, or if you can't do that, the HTML for the FORM.
Copy linkTweet thisAlerts:
@ryknowauthorFeb 16.2004 — Gil,

Here is the link.

https://www.benchmarkinvesting.com/ZZZTest/DowSearchWithRank.asp

The second part of the link after benchmarkinvesting.com is:

/ZZZTest/DowSearchWithRank.asp

It wouldn't print right in the preview so I had to separate it into two pieces.

The problem occurs on the left side in the ranking boxes. You have to select what you are going to rank it by also or it defaults to the selection criteria in the boxes above. One other error I have noticed is that if I use a number in the first box that is double digits and higher than the number in the second box, it will only pop a message box if the number in the second box has a zero in front of it. It recognizes that 6 is higher than 4, but it doesn't think 10 is higher than 4. or 12 or 22, etc. But it does think that 30 is higher than 2. And 20 is higher than 1. So it is reading the second number as if the 4 is 40 or 3 is 30 or 2 is 20. Any ideas?

Thanks for any help,

Rick
Copy linkTweet thisAlerts:
@gil_davisFeb 16.2004 — Form values are STRINGs. When you compare strings to numbers, you seldom get the desired results. You can use parseInt(), parseFloat(), or Number() to cunvert string values to numbers. You can also multiply the form value by 1 to have javascript convert it free of charge.
if (document.frmRank.rank1.value [b]* 1 [/b]> 30)
Copy linkTweet thisAlerts:
@ryknowauthorFeb 16.2004 — Gil,

Thanks for the help with the multiplying. Any ideas about the Netscape problem and why it continues on to read all the code on the page rather than resetting the form and waiting for the user to input new numbers and press submit again? IE resets the form and waits for the user to input further numbers and press submit again.

Thanks,

Rick
Copy linkTweet thisAlerts:
@gil_davisFeb 16.2004 — JavaScript Error:
<a href="https://www.benchmarkinvesting.com/ZZZTest/DowSearchWithRank.asp,">https://www.benchmarkinvesting.com/ZZZTest/DowSearchWithRank.asp,</a>
line 507:

syntax error.

--&gt;
....^

Try //--&gt;
Copy linkTweet thisAlerts:
@ryknowauthorFeb 16.2004 — Gil,

I don't get the error. I am using NS 7.1. so that is where I am coming from. What version are you using?

Line 507 has some ASP code so there is no javascript there.

Thanks,

Rick
Copy linkTweet thisAlerts:
@gil_davisFeb 17.2004 — You did not originally specify which version of Netscape, so I assumed it was 4.x (the hardest to code for).

You have to View|Source at the browser and count lines. ASP doesn't get to the client side, and that is where the error is.

In NS 7.1, I selected the first strategy and Ranks 1 to 10 and hit submit. The page changed and the JS console reported
Error: menu[count][0].ref has no properties ... Line: 127[/quote]
However, this does not seem related to the submit problem. It is some kind of menu problem. Remember that the line number is from the client point of view.

You haven't changed the compare functions yet. Did you try my suggestion? That is probably your submit problem.

Also, this piece of code:
function reset()

{

frmRank.rank1.value = "1";

frmRank.rank2.value = "4";

}

-->

</SCRIPT>
[/quote]

That type of object access only works in IE. You need to qualify the object with "document.". This is also where NS 4 gave the error on line 507, the uncommented HTML comment end tag.

Also, you should not use reset() as a function name. It is a reserved word.
×

Success!

Help @ryknow 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.6,
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,
)...