Page 1 of 1

Cross browser compatibility issues with image preview script

Posted: Thu May 24, 2012 2:17 pm
by drayarms

Code: Select all

	

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML1.0 Transitional//EN"



"http//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 


<html xmlns="http://www.w3.org/1999/xhtml"> 


	<head> 

		<script type = "text/javascript" src="http://code.jquery.com/jquery-latest.js"> </script>


		<script type="text/javascript">

        		function readURL(input) {

            			if (input.files && input.files[0]) {

                			var reader = new FileReader();

                			reader.onload = function (e) {

                    				$('#blah').attr('src', e.target.result);

                			}

                			reader.readAsDataURL(input.files[0]);

            			}

        		}

    		</script>



	</head>


	<body>


		<form id="form1" runat="server" enctype="multipart/form-data">

        		<input type='file' onchange="readURL(this);" />

        		<img id="blah" src="#" width = "300px" max-height = "340px" alt="your image" />

    		</form>


	</body>



</html>


Re: Cross browser compatibility issues with image preview sc

Posted: Thu May 24, 2012 2:40 pm
by pickle
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2.1. When asking a question, be as specific as you can be, provide the relevant code and any other information that is helpful in a concise and coherent manner. If you are not sure how to do that, read these guidelines.
Posting no context will get you absolutely no help.