JavaScript - Save Dialog For Zip File - Urgent Help!
I have a ZIP file in the server. I want create a create a save dialog to save the zip file in local machine.
The below code works perfectly fine for firefox but not on IE. apparently I want the code to work in IE. this is 4th JS forum I am posting my question......any help is greatly appreciated. <html> <head></head> <script language='javascript'> function JBTRunZip( ){ location.href="IMAN_IMAGE_FILES.zip"; } function download(locate){ window.open(locate) } </script> <body> <button onclick="JBTRunZip()">generateZip</Button> <td><input type ="Button" value ="Scarica" onclick="download('Test.zip');"></td> </body> </html> Similar TutorialsI have searched this, I promise. But everything I've tried either does nothing or just opens a new window. All I want to be able to do is to have a button that when the user clicks on it, it will open a "save as" dialog box so they can save a file (a separate file, not the html one that they are looking at) from my server. Is this really not possible using javascript, or am I just completely confused again? Hey guys, I've been experimenting around with a way to get a "Save As" dialog to pop up prompting the user to download a certain file from the server. How I've done this so far is open a window in Javascript to a PHP file, server side, passing an argument through _GET. The PHP generates the file and then sends a header request to download. Simple enough. The problem is that using this method opens a blank window in addition to the Save As Dialog. Is there anyway to fool the browser/ hide the window/ etc, so two windows don't pop up at the same time everytime my users press the download button? I am also pretty familiar with AJAX techniques, so if anyone has a solution along that route as well I'd appreciate it. Cheers, Q hii i am doing a project and i meet some problem i create a dojo dialog box i need to style the dialog box into whole thing white but i am not able to style the border (the grey line) between the title and content so i was wondering how am i goin to style it into white? i don't use the css to style it so i was wondering how to write it like " noteDlg.titleBar.style.background = 'white'; " this kind to remove the grey line between the title and content thanks ps. I really need it very urgently...hope reply asap function note(){ noteDlg = new dijit.Dialog({ title: "Programatic Dialog Creation", draggable: false, style: "width: 300px; border:0px; " }); // set the content of the dialog: noteDlg.attr("content", "Hey, I wasn't there before, I was added at "); noteDlg.titleBar.style.background = 'white'; noteDlg.show(); } Hey Guys, I'm working on a Gameserver for a Game, written in JavaScript. I want to save all console.log()'s with Timestamp into a txt-file but I don't know how :/ Could you help me with it and tell me how I can do this? for example, I want to save User-Logins into the logs. This is the code I'm using right now. Code: case "LOGIN": var data = PacketModels.login.parse(datapacket); User.login(data.username, data.password, data.is_banned, data.is_online, function(result, user){ if(result){ if(user.is_banned == 1){ console.log("[WARNING] ".red + data.username + " tried to login. It failed because the User is banned!"); c.socket.write(packet.build(["LOGIN", "ISBANNED"])); }else if(user.is_banned == 0){ if(user.is_online == 1){ console.log("[WARNING] ".red + data.username + " tried to login. It failed because the User is already online!"); c.socket.write(packet.build(["LOGIN", "ALREADYLOGGEDIN"])); }else if(user.is_online == 0){ c.user = user; c.enterroom(c.user.current_room); c.user.is_online = 1; c.user.save(); c.socket.write(packet.build(["LOGIN", "TRUE", c.user.current_room, c.user.pos_x, c.user.pos_y, c.user.username])); console.log("[INFO] ".blue + data.username + " has logged in on Map:[" + (c.user.current_room_name).blue + "] X:[" + String(c.user.pos_x).blue + "] Y:[" + String(c.user.pos_y).blue + "]"); } } ... Reply With Quote 12-22-2014, 02:48 PM #2 sunfighter View Profile View Forum Posts Senior Coder Join Date Jan 2011 Location Missouri Posts 4,830 Thanks 25 Thanked 672 Times in 671 Posts JS will not save a text file. You need to do this with a server side language like PHP and if your going to all of that trouble you might want to study a database at the same time or soon after. This is code use to save XML file using Javascipt but it can't not save full Processing Instruction, example we have PI is <?xml version="1.0" encoding="utf8"> when run the code then PI is saved with <?xml version="1.0"> and sometime it doesn't word. Please help me fix, thanks PHP Code: function SaveXML(xmlDoc,filename) { var outputXML = xmlDoc.xml; var mfObj = new ActiveXObject("Scripting.FileSystemObject"); var absPath = getPath(); var file = mfObj.CreateTextFile(absPath + filename, true); file.Write(outputXML); file.Close(); } function getPath() { var path = document.location; var str = new String(path); var end = str.lastIndexOf("/"); var absolutePath = str.substring(8, end) + "/"; absolutePath = absolutePath.replace(/%20/g, " "); return absolutePath; } Hello, i m new Javascript but knows basics of functions etc. ive created a website, which also has field to Submit Email addresses for newsletters.. Now, i have a TextBox (for users to write email addresses) and a Submit button in which i want to call a Javascipt script function which OnClick takes the value(email address) from the textbox and saves it to a .txt file on server. i think i am just missing a single line, the function name which will store the value.. i searched ovr the net but didnt find it.. plz help mee. Thankyou! hi, i want to create a extension for chrome using which i can save the current tab url in a text file. thanks sanjay Hi, Is there any way (any api) to display the confirm dialog box with yes/no buttons instead of ok/cancel in javascript. Can any one please let me know. Thanks in advance. Hey Scripters, I need to complete a task for a friend and I am stuck at this part. I am new with Javascript but I'm his only friend that knows a bit of Javascript. So for this problematic part of my task, I need to use tables and dialog boxes. First of all I need to define an array of 3 elements. Each element is associated with a different first name. Then I shall realize a first function to add a name in the table. The function takes as parameter the table previously created and return it containing an additional element whose value is the name that the visitor wants to add. I must use the dialog box prompt so that the user can specify the name he wishes to add in the table. I shall also perform a second function which will display the name that is included in the different array elements. This function will also take the table in parameters and proceed with setting the display name with a dialog box alert type that contains all of the name separated by ";". Help is very much appreciated. Please don't post links, I need explanations, so that I can understand next time I encounter this situation. I have created a button with a window.confirm() method but when I click on it in firefox the dialog box does not appear. It does however appear in all the other browsers
Hello, I have some code to open 1 dialog box. Could someone please help me manipulate this code to open multiple boxes with different contents. I would like to do this with out duplicating the existing code, maybe setting a variable. The least amount of code the better. Thanks in advance. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <meta charset="utf-8"> <title></title> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script> </head><body> <div id="dialog" title="Example dialog"> <p>Some text that you want to display to the user.</p> </div> <script type="text/javascript"> $(document).ready(function() { $("#dialog").dialog({ bgiframe: true, autoOpen: false, height: 100, modal: true }); }); </script> <a href="#" onclick="jQuery('#dialog').dialog('open'); return false">Click here to see the popup</a> </body> </html> http://tinyurl.com/bw2y3sr This is my site and I want to create a Yes and No dialogue box when user closes a browser so this popup confirm dialogue should appear. Can anyone help me? Hello, I have a dialog box and in there I have a button that says New Service. When a user clicks on New Service, another dialog is shown where they the put the name of the service and after they click Create, I want that dialog box and the first one close as well. Here is my code, I can't figure it out. I want the #create-userDialog box to close after the user clicks on Create in #new-serviceDialog. <script> $(function() { $( "#dialog:ui-dialog" ).dialog( "destroy" ); $( "#create-userDialog" ).dialog({ autoOpen: false, width: 600, modal: true, buttons: { "OPEN": function() { var bValid = true; allFields.removeClass( "ui-state-error" ); }, CLOSE: function() { $( this ).dialog( "close" ); } }, close: function() { allFields.val( "" ).removeClass( "ui-state-error" ); } }); $( "#create-user" ) .button() .click(function() { $( "#create-userDialog" ).dialog( "open" ); }); $( "#new-serviceDialog" ).dialog({ autoOpen: false, width: 400, modal: true, buttons: { "Create": function() { var bValid = true; onclick = $( this ).dialog( "close" ); allFields.removeClass( "ui-state-error" ); }, Close: function() { $( this ).dialog( "close" ); } }, close: function() { allFields.val( "" ).removeClass( "ui-state-error" ); } }); $( "#new-service" ) .button() .click(function() { $( "#new-serviceDialog" ).dialog( "open" ); }); }); </script> Hey there guys, i've been having a problem lately and i can't seem to find any solution for that. I know you guys could help me, so here it goes: I have a javascript promt box (as you can see in the code below) it works perfectly fine with internet explorer however it's NOT working in firefox. I tried everything i can think of, but still its not working! Please check the code below and give me the solution for firefox. Thank You! <%@LANGUAGE="VBSCRIPT" CODEPAGE="28592"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /> <title>Choose Your Language</title> <script language="javascript" type="text/javascript"> function checklang() { var lang = prompt('Choose A Language:'+'\n' + "(Ex: Armenian, Arabic, English, French, Greek, Russian)",'English'); if (lang==null || lang=="") {lang=""; return;} if (lang=="Armenian" || lang=="Arabic" || lang=="English" || lang=="French" || lang=="Greek" || lang=="Russian") {location.href = "sermon-section.asp?lang="+lang}; else location.reload(); } </script> </head> <body> <a href="#" onclick="checklang()">Choose Your Language</a> </body> </html> Hi! Trying to get a delete confirm dialog box to open when you click on the button. Here's what I have in the body... @if (Model.Layer.Id > 0){ <div style="float: left; padding-left: 14px;"> @using (Html.BeginForm("Delete", "Layer", new { layerId = Model.Layer.Id, subAccountId = Model.SubAccount.Id })){ <input type="image" src="/Portal/Content/images/admin-delete-off-btn.png" onmouseover="this.src='/Portal/Content/images/admin-delete-on-btn.png'" onmouseout="this.src='/Portal/Content/images/admin-delete-off-btn.png'" title="Delete button" value="Delete" alt="Delete" /> } </div> } I can't seem to figure out the script to make this work. Can anyone help? What I had was <script type="text/javascript"> function confirmDeleteSelected(id) { jQuery("#dialog-confirmDelete").dialog({ closeOnEscape: false, resizable: false, width: 250, modal: false, zIndex: 5000, buttons: { "Yes": function () { doDeleteSelected(id); jQuery(this).dialog("close"); jQuery(this).dialog("destroy"); }, "No": function () { jQuery(this).dialog("close"); jQuery(this).dialog("destroy"); } } //end Buttons }); } </script> Thanks Phil hey another know how can i change the background color of the title bar in the dojo dialog box? cause i search and i couldn't find any way.... Please help me and reply asap Thanks p.s if can show me sample code of how to change Hi, i have an popup which is an aspx page and when i click on browser close button..., the system should check if there is any unsaved data in the form or not. If there is any unsaved data then the message should be displayed (Do you want to leave..?) with OK and Cancel button... On click of the OK button, the data should not be saved and the user should be returned parent form ie popup should be closed and return to the parent form.On click of the cancel button, the control should return to the Pop. I had tried the below code... window.onbeforeunload = close; function close() { var result=confirm("Do you really want to close this window"); if (result) { return true; } else { location.href = document.URL; } } The above code is not working ie the popup is getting closed even on click of closse button.... and when clicked on OK it is dispalying another msgbox with leave this page and Stay on this page buttons... Please help me regarding the same... Here's the code. what am I missing to make this work? Thank you in advanced! @if (Model.Layer.Id > 0){ <div style="float: left; padding-left: 14px;"> @using (Html.BeginForm("Delete", "Layer", new { layerId = Model.Layer.Id, subAccountId = Model.SubAccount.Id })){ <input type="image" src="/Portal/Content/images/admin-delete-off-btn.png" onmouseover="this.src='/Portal/Content/images/admin-delete-on-btn.png'" onmouseout="this.src='/Portal/Content/images/admin-delete-off-btn.png'" title="Delete button" value="Delete" alt="Delete" /> } </div> } <div class="clear"></div> <div id="dialogDeleteBox" title="Delete Confirm" style="display: none"> <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 40px 0;"></span> <div id="confirmDeleteLayer"> <div id="confirmDeleteLayerMessage"> <p> Are you sure you want to delete this group? </p> </div> </div> </div> I have written base rel="nofollow" target="_self" tag in head tag. It works fine in IE6 but not in IE8. window.showModalDialog() opens up new ModalDialog instead of using existing Dialog. Can anybody help me?
|