Click to See Complete Forum and Search --> : Stupid Undifined!!!!!


idiotsoftcorp
01-03-2004, 04:33 PM
This STUPID script always says 'stu' is undined!
<script>
count = 0
function stupido(){
count = count+1;
if(count == 1){
var stu =prompt("Enter in a URL such as","http://idiotsoftcorp.tripod.com");
}
else{
alert("Only once please! That was click # " +count+"!\n\nPLEASE STOP CLICKING NOW!!!!!!!!");
window.status="GO AWAY! That was click number" +count +"! Stop it NOW!";
window.location=stu;
}
}
function stupid()
{window.location=stu;}
</script>
<form>
<input type="button" onClick="stupido()" value="Try Me!">
</form>
<form>
<input type="button" onClick="stupid()" value="Try Me 2nd">
No, this isn't something i just copied.I either wrote or understood it.When you click 'Try me' it askes you for a URL which is what I want.After that, though if you click 'Try me 2nd
it says 'stu' is undifined.But I just defined it!Some help?Please?

fredmv
01-03-2004, 04:44 PM
<script type="text/javascript">
//<![CDATA[
var count = 0;
//]]>
</script><input type="button" onclick="if(++count > 1) alert('!!!');" value="foo" />

idiotsoftcorp
01-03-2004, 10:01 PM
I aprreciate your help but IT DOESN'T DO WHAT I WANT!I don't care about the clicking more than once.That's covered.What i want is that it doesn't say 'stu' is undefined after I just defined it by clicking the first button!Or maybe i'm just not usin it right!

fredmv
01-03-2004, 10:23 PM
http://www.codingforums.com/showthread.php?s=&threadid=26464

ray326
01-04-2004, 12:08 PM
<form>
<input type="button" onClick="stupido()" value="Try Me!">
</form>
<form>
<input type="button" onClick="stupid()" value="Try Me 2nd">

Inputs have to be contained in forms.

idiotsoftcorp
01-05-2004, 05:45 PM
no they don't!!!!!Thank you FREDMV!!!!it took some work but i made it work!

fredmv
01-05-2004, 05:51 PM
You're welcome; it was merely a scoping issue.

ray326
01-05-2004, 06:40 PM
Originally posted by idiotsoftcorp
no they don't!!!!!Thank you FREDMV!!!!it took some work but i made it work! Yes they do and whether you can "make it work" with invalid HTML is irrelevent.

fredmv
01-05-2004, 07:13 PM
Ray is completely correct. Form elements belong within a <form> tag. While modern browsers will still render the form elements, older ones, such as Netscape 4.x, will not even render the form elements without them being surrounded with <form> tags.

96turnerri
01-05-2004, 07:34 PM
yeah but honestly what % of people use NN4.x?

fredmv
01-05-2004, 07:41 PM
Originally posted by 96turnerri
yeah but honestly what % of people use NN4.x? To put it simply, more than you think (I, however, do not). It will make your forms inaccessible to some amount of users. Moreover, it isn't correct markup. Form elements belong within <form> tags, and that's all there is to it.

96turnerri
01-05-2004, 08:37 PM
yeah i do put form elements inside <form> becasue they are elements of a form hence form elements. im just asking how many people use nn4.x approximatly

fredmv
01-05-2004, 08:41 PM
http://www.upsdell.com/BrowserNews/stat.htm

96turnerri
01-06-2004, 09:05 AM
about 1.4% then not alot lol

olerag
01-06-2004, 09:27 AM
Unfortunately for me I have to develop for certain government
agencies that still serve antiquanted browers, such as NN4x
and IE5 while other users access newer ones. What fun.

The best thing I like about Fred's link is the "Stat Quotes"
anchor. And check out the discrepancy between Source 1 and
Source 4 for Gecko-based browsers.

96turnerri
01-06-2004, 10:40 AM
lol 20% but read text on left of page about stats being misleading

idiotsoftcorp
01-06-2004, 05:37 PM
Well even if it isn't correct I DON'T CARE.I have ie6 and it works fine!I am not using this for a webpage so almost no one else will see it! I was writing this script for ME.I was trying to expand my javascript programming knowleage.

96turnerri
01-07-2004, 10:13 AM
ok so your trying to teach yourself, but what is the point in teaching yourself invalid HTML? defeats the object really

idiotsoftcorp
01-12-2004, 07:28 PM
ok!!'You were right and I was wrong'!!Happy?