Click to See Complete Forum and Search --> : onclick doesnt work on MAC
pym59
09-25-2003, 02:15 PM
the following is working fine under IE5+ and not under MAC anyone has an idea? It seems that the onclick does not work at all
Thanks in advance
<head>
<meta http-equiv="Content-Language" content="fr-ch">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Le mot le plus long</title>
<link href="style.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="javascript">
<!--
function fillarray()
{
..
}
function efface(reponse)
{
..
}
function filltext(lettre,champ,bouton,boutonchamp)
{
..
}
-->
</SCRIPT>
</head>
<body bgcolor="#A5B7C2" onload="javascript:fillarray()">
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0"><tr> <td width="70%" class="Content">
<form action='mots.php' method='post'>
<img name='bouton1' value='Q' src='images/q.gif' onclick=javascript:filltext('Q',reponse,1,bouton1)>
<img name='bouton2' value='R' src='images/r.gif' onclick=javascript:filltext('R',reponse,2,bouton2)>
<input type='submit' name='submit' value='Valider'>
<input type='reset' value='Effacer' name='Effacer' onclick=javascript:efface(reponse)>
</form>
</body>
</html>
Charles
09-25-2003, 02:27 PM
Originally posted by pym59
the following is working fine under IE5+ Actually, it fails for between 6 and 14% of users of IE5+ and more than 13% of all users. That's why you should never make a JavaScript dependant web page. Mac users only represent 2% of the market so don't worry about them. Worry about all of the good JavaScript free folks.
pym59
09-25-2003, 03:47 PM
I am not sure i really understand your answer.
what do you mean by
Actually, it fails for..more than 13% of all users.
Is the code so bad written that for 13% of the users, this will not work. What i have make wrong?
Thanks for helping better coding
Charles
09-25-2003, 03:51 PM
13% of users do not use JavaScript and some of them cannot use JavaScript because of some disability. Do not make a JavaScript dependant page and all will be well.
James L.
09-25-2003, 07:30 PM
"Mac users only represent 2% of the market so don't worry about them."
What an ludicrious comment.... Apple has shipped 46 million Macs, and recently stated that over 8,000,000 people are using the current OS. Double this for the number of users still using older OS's, and your advice is to ignore 16 million people who are currently surfing the web.
Talk about ignorant. For someone who preaches standards, it seems silly to me that you would offer your advice such as this. Especially since you usually offer good advice on these boards.
I use JavaScript on a Mac on a regular basis, and I have no problems whatsoever with the onClick event handler. If I have time later I will see what is going on with your code.
Charles
09-26-2003, 05:58 AM
See http://www.thecounter.com/stats/2003/May/index.php for the source of my statistics but I think that you misunderstand me. It's not OK to make a site that works for the 2% of Mac users but that fails for the 13% of Non-JavaScript users. And if your page works for people who do not use JavaScript then you don't have to worry that the JavaScript that is on your site is specific to a browser or OS.
We don't have the full page in this case, so we cannot know if this script is fluff or essential. Oddly enough, if the JavaScript is fluff then it's worth making it work on the Mac but if it's essentioal then they need rethink the project.
pym59
09-26-2003, 06:33 AM
ok i explain what i am trying to do as a java beginners. The ideas is to have to find out the longuest possible word with letters which are random picked up (this part is in php and not visible in the script. The user click on the letter on the letter should appear un the input field. Afet the user thing he has made the longuest word, he clicks on submit, it the php code also chech if the word exists and if it is the longuest.
I find cool that some Java gurus try to tell me what is wrong, but dont forget i am a java beginners
Thanks
<head>
<meta http-equiv="Content-Language" content="fr-ch">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Le mot le plus long</title>
<link href="style.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="javascript">
<!--
var utilises = new Array(50);
var lettres = new Array(50);
var boutons = new Array(50);
function redirect(url)
{
if (url == 0) window.location = 'resultat.php?log=rate';
if (url != 0) window.location = 'resultat.php?log=bravo&point=' + url;
}
function fillarray()
{
for (i=1;i<40 ;i++) {utilises[i] = 0;lettres[i]='';boutons[i]=0;}
setTimeout("redirect(0)",30000);
}
function efface(reponse)
{
for (i=1;i<40 ;i++) {
if (boutons[i] != 0) {boutons[i].src = 'images/'+lettres[i].toLowerCase()+'.gif';}}
for (i=1;i<40 ;i++) {utilises[i] = 0;lettres[i]='';boutons[i]=0;}
reponse.value= "";
}
function filltext(lettre,champ,bouton,boutonchamp)
{
if (utilises[bouton] != 1) {
champ.value = champ.value + lettre;
lettres[bouton]=lettre;
boutons[bouton] = boutonchamp;
boutonchamp.src='images/'+lettre.toLowerCase()+'r.gif';} else
alert("Hey!! vous avez déjà utilisez cette lettre");
utilises[bouton] = 1;
}
-->
</SCRIPT>
</head>
<body bgcolor="#A5B7C2" onload="fillarray()">
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
<tr> <td width="70%" class="Content">
<form action='mots.php' method='post'>
<p style = 'Content' align = 'center'><font size="+1">Le mot le plus long</font><br><br><br>
<img name='bouton1' value='R' src='images/r.gif' onclick=filltext('R',reponse,1,bouton1)>
<img name='bouton2' value='D' src='images/d.gif' onclick=filltext('D',reponse,2,bouton2)>
<img name='bouton3' value='Z' src='images/z.gif' onclick=filltext('Z',reponse,3,bouton3)>
<img name='bouton4' value='M' src='images/m.gif' onclick=filltext('M',reponse,4,bouton4)>
<img name='bouton5' value='B' src='images/b.gif' onclick=filltext('B',reponse,5,bouton5)>
<img name='bouton6' value='I' src='images/i.gif' onclick=filltext('I',reponse,6,bouton6)>
<img name='bouton7' value='A' src='images/a.gif' onclick=filltext('A',reponse,7,bouton7)>
<img name='bouton8' value='E' src='images/e.gif' onclick=filltext('E',reponse,8,bouton8)>
<img name='bouton9' value='E' src='images/e.gif' onclick=filltext('E',reponse,9,bouton9)>
<br><br>Réponse <input type='text' readonly name='reponse' value=''>
<input type='hidden' name='lettre' value='RDZMBIAEE'></p><p align = 'center'>
<input type='submit' name='submit' value='Valider'>
<input type='reset' value='Effacer' name='Effacer' onclick='efface(reponse)'></p>
</form></td>></tr>
</table>
</body>
</html>
James L.
09-26-2003, 08:50 AM
well clarified Charles, and I agree.
I find that Javascript, however, is much akin to CSS in the sense that if it is coded properly (standards), that the vast majority of browsers will understand it. Sort of the same concept as standards vs. quirks mode. It isn't too often that you need to code JS specific to one browser (except maybe IE Win, but we all know that browser blows).
Cheers.