...

View Full Version : alert not working on firefox



o0O0o.o0O0o
04-29-2008, 04:44 AM
hi ,

i have this simple file , its working on IE but not on firefox


<html>
<body>


<input type=button id='button1' value='Mark paid' onclick='javascript:alert();'>

<input type=button id='button2' value='Mark paid' onclick='alert();'>
</body>
</html>

A1ien51
04-29-2008, 05:10 AM
um, do not use javascript: in the event handlers. not needed.

When you look at the error console, are you seeing any errors? Reason you are not supplying a value inside the alert?

Eric

o0O0o.o0O0o
04-29-2008, 05:37 AM
Nothing appears at the error console . But when i add alert("jj") , its working.
I was just testing my script step by step by placing alert to find the error

But the empty alert box was running on apera and IE .

whats the other main diff between FF and IE .

someone told me that FF cares about empty space between tags. What difference can that make in my scripts

Kor
04-29-2008, 08:26 AM
Simply Mozilla will not alert nothing, which seems reasonable. alert() method needs an argument by all means.


whats the other main diff between FF and IE .

There are a lot of differences between FF and IE. There are many differences between all the browsers (IE, Moz, Opera, Safari...) and between the same browser's versions. Too many to be posted here.


someone told me that FF cares about empty space between tags. What difference can that make in my scripts

Yes. FF takes all the empty spaces between tags as empty textNodes in DOM tree, while IE takes only some of them. That should be considered when circle through the childNodes of a parent or when some reference methods are used (nextSibling(), previousSibling()) That means you should check for the nodeType of an element to be sure it is a tag or a textNode.

Ex, referring the next tag sibling


var nextS=element.nextSibling;
while(nextS.nodeType!=1){
nextS=nextS.nextSibling;
}

BubikolRamios
08-31-2008, 10:23 AM
Hmm looking at ur code, and picking something from net:

http://www.thewatchmakerproject.com/journal/329/finding-html-elements-using-javascript-nextsibling-and-previoussibling

But it does not work. why ?




Object.prototype.previousObject = function()
{
var nextS=this.previousSibling;
while(nextS.nodeType!=1)
{
nextS=nextS.previousSibling;
}
return nextS;
};


forinstance, something like this:



alert(sender.parentNode.previousObject);


returns:

var nextS=this.previousSibling;
while(nextS.nodeType!=1)
{
nextS=nextS.previousSibling;
}
return nextS;

jhouns
08-31-2008, 11:06 PM
hi ,

i have this simple file , its working on IE but not on firefox


<html>
<body>


<input type=button id='button1' value='Mark paid' onclick='javascript:alert();'>

<input type=button id='button2' value='Mark paid' onclick='alert();'>
</body>
</html>

if you are asking for why it doesn't work i dont think i can help you but wouldnt a simple fix (yes very simple) be


<html>
<head>
<script type="text/javascript">
function disp_alert()
{
alert("INSERT THE ALERT INFO HERE");
}
</script>
</head>
<body>


<input type=button id='button1' value='Mark paid' onclick='disp_alert();'>

<input type=button id='button2' value='Mark paid' onclick='disp_alert();'>

</body>
</html>


if all you wanted it to do was display an alert box at the touch of a button. please correct me if i have completely misunderstood lol.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum