Results 1 to 2 of 2

Thread: Works with IE but not with Firefox :S

  1. #1
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Works with IE but not with Firefox :S

    Hi there,

    I have this JavaScript which works really good with IE but not with firefox, how can I fix it to work with Firefox too?

    Source:
    Code:
         <center><input type="submit" value="Upload!" type="submit" class="lstbox" id="upload" onclick="document.getElementById('text1').style.visibility= 'visible';">
     <div id="text1" style="visibility:hidden;">
    <p align="center">
    <b><font size="4">
    <marquee direction="right" scrolldelay="50" behavior="alternate">...</marquee></font>Uploading In Process...</b>
    <b><font size="4">
    <marquee direction="right" scrolldelay="50" behavior="alternate">...</marquee></font></b></p>
    
    </center>
    <HEAD>
    
    <script type="text/javascript">
    <!--
    function confirmation() {
    	var answer = confirm("Are you sure you want to cancel your upload?")
    	if (answer){
    		alert("You have successfully cancelled your upload")
    		window.location = "index.php";
    	}
    	else{
    		alert("Your upload has not been cancelled and will be continued")
    	}
    }
    //-->
    </script>
    <form>
    <input type="button" onclick="confirmation()" value="Cancel Your Upload?">
    </div>
    </form>
    Thanks very much.

    Best Regards,
    Private_Guy

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    The code you've provided works both in IE 7 and Firefox 2.0.0.4 in similar way. Inorder to avoid some mismatches of tags in your source I've arranged them which you can see below:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    	<head>
    		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    		<title>Untitled Document</title>
    		<style type="text/css">
    
    		</style>
    		<script type="text/javascript">
    			function confirmation() {
    				var answer = confirm("Are you sure you want to cancel your upload?")
    				if (answer){
    					alert("You have successfully cancelled your upload")
    					window.location = "index.php";
    				}
    				else {
    					alert("Your upload has not been cancelled and will be continued")
    				}
    			}
    		</script>
    	</head>
    	<body>
    		<center><input type="submit" value="Upload!" type="submit" class="lstbox" id="upload" onclick="document.getElementById('text1').style.visibility= 'visible';">
    		 <div id="text1" style="visibility:hidden;">
    			<p align="center">
    				<b><font size="4">
    					<marquee direction="right" scrolldelay="50" behavior="alternate">...</marquee></font>Uploading In Process...</b></font>
    				<b><font size="4">
    					<marquee direction="right" scrolldelay="50" behavior="alternate">...</marquee></font></b>
    			</p>
    		 </div>
    		</center>
    		<form>
    			<input type="button" onclick="confirmation()" value="Cancel Your Upload?" />
    		
    		</form>
    	</body>
    </html>
    It would be better if you avoid the usage of <b> and <font> tags and use CSS for them. I haven't changed your code much which can be arranged in a far better manner for example you can have a <form> tag in which you can place all the form fields (submit button & a command button) like that but the aim of mine was just to check whether it is working or not.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •