•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 401,525 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,367 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1182 | Replies: 2 | Solved
![]() |
hi friends
i have a problem in previewing image in mozilla browser.I will give the code.
only few codes are written.I think you can understand this.
This will work in IE.When i click the browse button and selected a particular image it will be shown below to that browse button.But in Mozilla it wont showing .. please help me
thanks in advance
i have a problem in previewing image in mozilla browser.I will give the code.
script code
<script type="text/javascript">
function loading(img)
{
document.getElementById('disp').src=img;
}
</script>
jsp page code
<html:file property="productImage" value="${product.productImage}" styleClass="sni_input" onchange="loading(this.value)"/>
<img src="" id="disp">only few codes are written.I think you can understand this.
This will work in IE.When i click the browse button and selected a particular image it will be shown below to that browse button.But in Mozilla it wont showing .. please help me
thanks in advance
This is because the value which you receive in the upload box is a Windows specific path. IE would obviously know how to interpret it but Mozilla won't.
To make this possible, you have to convert your windows path into a file resource which can be used by all browsers using the file protocol. Try this:
Keep in mind that there is no such thign mentioned in the specification which says that the path to the local resource can be successfully retrieved from the file select control and hence even the above trick might not work in some browsers like Opera.
To make this possible, you have to convert your windows path into a file resource which can be used by all browsers using the file protocol. Try this:
<!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=UTF-8" />
<meta http-equiv="Expires" content="0" /> <!-- disable caching -->
<title>Example</title>
<script type="text/javascript">
function getData(srci) {
srci = srci.replace(/\\/g, "/"); /* convert all \ to / */
encodeURI(srci); /* encode the URI to enable escaping */
srci = "file://" + srci;
alert("File resource at : " + srci);
document.images[0].src = srci;
}
</script>
</head>
<body>
<form action="#">
<input type="file" onchange="getData(this.value);">
<br><br>
<image src="#" alt="image">
</form>
</body>
</html> "I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
adsl adsl1 adsl2 adsl2+ ajax asp browser browsers cable connection cross-browser javascript menu with few lines of code developer development download email europe firefox gecko html internet internet explorer javascript javascript smooth scrolling scroll smoothly window document position javascript tab menu with rounded corners generator kb kbps leak linux mbit memory microsoft mozilla msdn network news office open source per second site software sql testing throughput thunderbird upload users vista web 240000
- Previous Thread: Need Client Machine's System information
- Next Thread: urgently need help!!!



Linear Mode