|
How do you mean? Use an ImageButton as the main image or as the thumbnails?
I'm guessing you mean as the thumbnails. In which case my question would be, can I create them at run time and give them a function to call where I can pass parameters?
|
|
|
|
|
Well this is what I ended up doing. I think it is along the lines of what Paddy had suggested...
<img alt="" src="<%=GetImageThumbnailUrl(drimage.Item("ImageId")) %>" onclick="javascript:window.location.href='ViewAlbum.aspx?AlbumId=<%=sAlbumId%>&CurrentImage=<%=drimage.Item("ImageId")%>'"/>
It works but I don't like that the whole page has to reload. I guess that's the only way to do it, if anyone knows of a better way to do this than what I ended up doing then please let me know!
Thanks to ALL of you who helped soooo much!
Thanks again!
|
|
|
|
|
Hello,
does anyone know if it possible to read data from a javascript form and write it into a database (Access for example)? I have an online form that i used with cgi-mail and now i need to save the info on a database, any help would be appreciated...
Thanks
Rona
|
|
|
|
|
JavaScript should never directly communicate with a database because then the user would be able to see the passwords etc for it.
What you should do is have it call a PHP/ASP page that will do the database work for it.
Brad
Australian
By contacting your lawyer you negate the right to sue me.
|
|
|
|
|
JavaScript is a scripting language that runs inside the browser and stays inside the browser. JavaScript can't be made to access anything external on the users computer, such as files on the users hard drive, or change settings on the users computer. If it did it would constitute a major security risk.
So basically what you're asking is impossible, you can't access a database directly but, as the other poster says, you could do it indirectly via a server side script in ASP/PHP etc, but it would have to be a database on the server and not on the users computer. You could get JavaScript to initiate a page post back, or use Ajax to call a server side ASP.NET page which connects to the database.
|
|
|
|
|
Yes it is possible, but unless you really really really need to (and even if you think you need to you probably don't and you certainly shouldn't) then don't.
var objConn = new ActiveXObject('ADODB.Connection');
var objRs = new ActiveXObject('ADODB.Recordset');
objConn.Open(conn_string);
objRs.Open('SELECT * FROM table', objConn, 2, 3);
if(!objRs.BOF)
{
objRs.MoveFirst();
while(!objRs.EOF)
{
document.writeln(objRs.Fields("title").Value +'<br/>\n');
objRs.MoveNext();
}
} It will work, but you will have to have extremely low security settings in IE (it will only work in IE). The user will also get a couple of security warnings which you can't get rid of. The above is provided merely as evidence that it is possible, if you haven't got the hint yet then I'll say once more.... please don't use this for anything other then learning.
As you're using cgi-mail, you obviously have access to some server-side technology so use that for communicating with your DB.
HTH
|
|
|
|
|
it will only work in IE
So for all intents and purposes, it doesn't work
|
|
|
|
|
Are there any such editor that you can recommend from your experience. I need to be able to introduce my custom objects in it for user to drag and drop. Like custom images and stuff. That's is how I need it to be customizable.
My application is a dynamic content capture tool. Admin folks define the fields in the system and also define the layout. It's the layout part that I need the HTML Editor for. All the fields need to be identifiable in the editor. So Admin User should be able to drag and drop Name and Age fields etc.
Thanks
|
|
|
|
|
|
I wish test if some client side file exists, like swf, jpg, gif, css, etc. Do you know some method to test this?
Regards
-- modified at 17:36 Wednesday 29th November, 2006
Sample:
If one image does not exists, the IE shows a red X icon. I wish with javascript, test if the image does not exists, simply to set css style to hide the image, then this red X icon will not appears.
-- modified at 17:36 Wednesday 29th November, 2006
Jesus is Love! Tell to someone!
|
|
|
|
|
Well I just hacked this together off the top of my head so it may/may not work properly, but it should get you pointed in the right direction.
I would advise you not to go down this road though. In order to get access to the filesystem, the users are required to set their browser's security settings extremely low. This is clearly not a good idea. That's why it's a default setting to have access to this stuff. It's also why you can't do much with file input boxes using javascript. It poses a huge security risk and I repeat I advise you not head down this road. Perhaps if you explained your reasons for wanting to do this we could offer some alternative solutions/ideas.
var filePath = 'c:\\test.txt';
if (navigator.userAgent.indexOf('MSIE') == -1 && Components)
{
try
{
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(filePath);
if (file.exists())
{
alert('Found!');
}
else
{
alert('Not found!');
}
}
catch(e)
{
alert(e);
}
}
else
{
try
{
var objA = new ActiveXObject('Scripting.FileSystemObject');
if(objA.FileExists(filePath))
{
alert('Found!');
}
else
{
alert('Not found!');
}
}
catch(e)
{
alert(e.message);
}
}
The IE stuff will work definately work, but I haven't tested the mozilla code (only have IE installed atm), so not too sure if that will work straight away or not, at the least it should point you in the right direction.
HTH
|
|
|
|
|
Thank you Torsten
I wish not access none file in user file system, just the files of my web app. By example, my website has one image, located in my site folder "/images/MyImage.jpg". Of course, in server I can use asp.net to check file exists, etc.
Resuming:
I wish this in javascript. If one image does not exists, the IE shows a red X icon. I wish with javascript, test if the image does not exists, simply set css style to hide the image, then this red X icon will not appears.
Jesus is Love! Tell to someone!
|
|
|
|
|
Ok when you said "I wish test if some client side file exists" I understood that as that you were checking the client....anyway...
this will be a hell of a lot simpler
<img src="/images/MyImage.jpg" id="myImg" />
Then in a script block below have this:
var imgEle = document.getElementById('myImg');
imgEle.onerror = imgError;
function imgError()
{
imgEle.style.display = 'none';
}
Note: CP seems to be replacing some of the code...you should replace ".removed" with ".onerror" in the 2nd line of javascript.
HTH
|
|
|
|
|
High level, thank you very much
This code works to object tag? like wma, wmv, mp3, swf...
Regards
Jesus is Love! Tell to someone!
|
|
|
|
|
Off the top of my head, probably not (at least not without some wierd tricks), but feel free to try it and let us know how you get on
|
|
|
|
|
Howdy all?Am MARSHAX.I would like to be helped with a characters based code <preferably vb="" or="" java=""> that can search word/sentence across several html pages and list the result in most-similar-to-requested manner.Preferably a search limited to 7 words each with maximum of 13 characters and a search of upto 1000 pages.
One can get me thru eurodatacom2000@yahoo.co.uk.
-- modified at 7:23 Wednesday 29th November, 2006
|
|
|
|
|
Excuse my ignorance, but as a fairly newbie ASP.NET debugger, the caching is driving me insane. At seemingly random times, my changes just are not affected. I've even set Response.Expires to 0, but the old page before this is still being rendered.
I can't delete the temporary files because it says they're in use, and it really seems too much effort to go and do this all the time. What am I missing to end this trial?
|
|
|
|
|
To be honest it is more likely to be your browser caching things. Unless you have some cache directives used, then afaik asp.net will not cache your page.
Try the following:
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;
But you could also add the following to the top of your aspx file:
<%@ OutputCache Location="None" VaryByParam="None" %>
Or you can achieve this programatically by doing:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
HTH
|
|
|
|
|
I write the coding for mailing in my ASP page, which works fine if i upload it in a windows server.But it uploaded to Unix server it gives an error.As a think CDONTS is a windows componet it may not be work in Unix server.Is there any way to send mail in unix server from my asp page.
Plz Suggest.
DPM
|
|
|
|
|
ASP runs on unix???
Brad
Australian
By contacting your lawyer you negate the right to sue me.
|
|
|
|
|
I'm busy writing ASP.NET for OS X. One word: Mono.
|
|
|
|
|
hi all .. I was browsing the CodeProject looking for something then I get to the "user_reply.asp" Page and I found my self really interested in the preview button in the page specially that I'm not a good js Coder .. any way I found the button goes to the following function
function Preview() <br />
{<br />
if (Submitted) return false;<br />
PreviewWnd = open("","preview","toolbar=no,resizable=yes,scrollbars=yes,directories=no,menubar=no,width=400,height=300");<br />
document.MessageForm.action = "/script/comments/preview.asp";<br />
document.MessageForm.target = "preview";<br />
return true; <br />
}
three functions that I'm intersted in .. i know about "open" and "action" too .. but
1)how they are used here what is the scenario?? ..
2)does this code allready submits the form to the page "preview.asp"? or just change the forms action ?
3)and why set the "target" to preview ??
as being an ASP.net developper .. 4)is there a way to read "user_reply.asp" controls data in the server side code of "preview.asp" in order to construct the page according to user input ??
too many questions !!!
thanks in advance
|
|
|
|
|
Davids_Maguire wrote: 1)how they are used here what is the scenario?? ..
The script opens an empty popup window with the name "preview", sets the action of the form to the page to open, and sets the target to be the popup window. I assume that the function is called from an onsubmit event in a form tag, so that the form will be submitted to the popup window.
Davids_Maguire wrote: 2)does this code allready submits the form to the page "preview.asp"? or just change the forms action ?
The code itself does not submit the form.
Davids_Maguire wrote: 3)and why set the "target" to preview ??
Se my reply to question #1.
Davids_Maguire wrote: 4)is there a way to read "user_reply.asp" controls data in the server side code of "preview.asp" in order to construct the page according to user input ?
No, not exactly. You have access to the form data that was posted to the page, which is the data of the fields contained in the form that was posted. You don't have access to the controls themselves, or data from any controls outside that form.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks so much .. really your answer was very useful .. can I have an example about how to access these fields Contained in the form ..
and thanks again for your cooperation
|
|
|
|
|
Al the posted values are in the Request.Form collection.
---
b { font-weight: normal; }
|
|
|
|