|
Thanks but it doesn't work too.
Shay Noy
|
|
|
|
|
What's witht he CDATA[[ ]] ? This is Javascript, not XML...
anyway... I suspect this may be a Firefox issue... it works fine in IE, and there is nothing wrong, in principle, with what you're doing.
FF has an option to prevent scripts from updating images, but this is turned off by default - still, I can't help wondering if there is bug somewhere around that...
Be interesting to know if you ever get it sorted...
have you tried Googling for "javascript image preview" or some such? I vaguely remember coming across a script for this some time back...
Fred
|
|
|
|
|
I try to googling a lot, but with no success.
It doesn't preview image, can you post your html page because if it works to you, it should work to me too.
Perhaps this is a configuration problem?
I am working with ASP.NET 2005.
Please help, thank you
Shay Noy
|
|
|
|
|
My code is the same as yours, in essence - as I say, it works in IE but not FF. This has nothing to do with .NET - it is pure html/javascript.
<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
<!--
function PreviewImage(wThis) {
document.getElementById("img1").src=wThis.value;
}
// -->
</script>
</head>
<body>
<form>
<div>
<input id="File1" type="file" onchange="PreviewImage(this)" style="width: 240px" /></div>
<br>
<img src="" style="width: 96px; height: 96px" id="img1" name="img1" /> <br />
</form>
</body>
</html>
|
|
|
|
|
I copy the code to notepad and save as html. When I ran it, I got an Information bar as following:
"To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click here for options."
After click popu up the 3 options:
1) Allow Block content...
2) What the risk?
3)More information
I click the first option and click yes for stop blocking and then the code run well.
So I believe that this is the problem, How can I unblock through my code so everyone will be able to preview images on his computer?
Thank you.
Shay Noy
|
|
|
|
|
You will get this security warning if you run your HTML file by double-clicking it - but if you run it through a web-server it will not appear.
This will not be a problem for 99% of users. A small number may indeed have their security settings set to block all javascript, but very few, and there is nothing to can do about that - it's their choice, and they will know what they are missing out on.
So don't worry about it.
|
|
|
|
|
|
Hi All,
I have to save the webpage as html.In tht page, i have images,text and three buttons.The buttons like Print,Save As HTML and Close.If user click the save as html button then a save dialogbox should open and user'll give some file name for save that page.I got upto here but in that html page i am containg those three buttons.How to hide those buttons in save as html page.Plz give me solution for my problem...Its very urgent for now...
Thanks in advance.
Regards,
Dharani.
|
|
|
|
|
dharanighanta wrote: If user click the save as html button then a save dialogbox should open and user'll give some file name for save that page
Saving HTML page to client machine ? To remove those images, you need to look for images to be removed using regular expression and replace it with blank value.
|
|
|
|
|
Thanks for the reply.
Saving HTML page to client machine.I am getting images in that html page.whats my problem is in that page i am having 3 buttons.How to hide those buttons in html page?
|
|
|
|
|
dharanighanta wrote: i am having 3 buttons.How to hide those buttons in html page?
I presume that you know all these 3 buttons name. When you are creating HTML find these names and replace it with blank value.
Still I didn't understand how you will save HTML file to client machine, I don't think that ASP.NET will be having write permission on client drives ?
|
|
|
|
|
Sorry,Html page'll save in local systems only.
I am calling the following javascript function on the save as html button click event
function saveashtml()
{
window.document.execCommand('SaveAs',false,'C:\\file.html');
}
This function simply reads the entire page and save it into html page.
|
|
|
|
|
After saving the file open it using javascript and remove these unwanted image tags. Check this[^] for opening files in javascript.
|
|
|
|
|
Hi,
I have a few controls in my page.
I have two drop downlist controls in which the second one is populated when a value is selcted in the first dropdownlist .
During this post back the tab index is lost .The tab is going to the first control.
Can some one help me with this so that i can get the tab index to the next one,
Thank you,
hepsi
|
|
|
|
|
You could use AJAX to get the values, and set the selected box using javascript. Or, you could set the selected item in the selected index changed event handler.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to retain the tab index ov post back .
I'm not using ajax...
Hepsi
|
|
|
|
|
hepsy.i wrote: I want to retain the tab index ov post back .
I'm not using ajax...
Set MaintainScrollPositionOnPostback="true" if you are using ASP.NET 2.0.
|
|
|
|
|
Thank you,
i'm not using 2.0, i'm using 1.0.
i dont want the scroll bar postion...
i need the tab index to go to the next dropdownlist but its going to the first control.
Thank you
hepsi
|
|
|
|
|
To reiterate my answer - if you don't want to use AJAX ( and it would be nice if you did ), then you should set the selected item in your code behind, in the event handler for the first drop down list changing, the one that fills the second drop down list. If there's no property on the server side, you could certainly inject client side code that runs when the page has loaded.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Why don't you just use a variable to store the information pointing to the control which has focus?
When page reloads just fetch the data from the viewstate.
|
|
|
|
|
hi frndz,
I am using MS.net 1.1
i am selecting 20 employees with address from database .I want to show this in Datagrid.Upto this ok.
but my need is I want to show first 5 emplyees with address in first row of the datagrid and next 5 five in 2 row..
like..
expect ur kind help...
thankx in advance..
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
You'd need to use a repeater for that, then you can write the code to build the table as you're hoping.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thnak u
can u send any sample code's link ??
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Hi,
i am using Form Authentication in my asp.net appication. It creates a persistent cookie named Cookie1 in cookies folder at my system. I want to change/set the Name of this cookie to Cookie2 on the click of a button from page.How can i do that ? (Q: Does form authentication always created persistent cookie, how can i change it so that when i close the browser , the coookie also goes off ?)
Alternatly, if i can create a new form authentication cookie at the same place with the name Cookie2. i am using following code.But cannot see my cookie2 in the folder
protected void LinkButton2_Click(object sender, EventArgs e)
{
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, "username", DateTime.Now, DateTime.Now.AddMinutes(30), true, FormsAuthentication.FormsCookiePath);
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie authCookie = new HttpCookie("cookie2", encryptedTicket);
authCookie.Expires = System.DateTime.Now.AddMinutes(30);
authCookie.Secure = true;
Response.Cookies.Add(authCookie);
}
Any code support will be of great help.
Thx
|
|
|
|
|
i already post a message for u in Web Development forums
Hope it can help u
Regards,
Tomi
|
|
|
|