JavaScript - Javascript Causing 500 Server Error?
Hello there,
I am using Dynamic Drive's dhtml windowfile and when I had a link for it to call the popup window, it makes my site deliver a 500 server error. Here is the line of code I'm adding: Code: echo '<td><a class="link" href="#" onClick="ajaxwin=dhtmlwindow.open('ajaxbox', 'ajax', 'pages/post.php', 'Composing Mode: Post', 'width=650px,height=400px,left=300px,top=100px,resize=0,scrolling=1'); return false">Compose</a></td>'; It is not a php issue, I plaintext the link and it still did the same thing. Similar TutorialsI have trying to save an update the xml file which is there in same folder in which HTML page is there. In HTMl page i have written javascript code to Save and Update XML on server.The code is like this Code: function Save() { var xmlDoc= new ActiveXObject("MSXML.DOMDocument") xmlDoc.async="false" xmlDoc.load("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") //..code to modify xmlDoc xmlDoc.save ("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") xmlDoc = null; alert('Details saved'); } When i am accessing HTMl page on server from client and this function is called error 'Parameter is incorrect' is showing on line Code: xmlDoc.save ("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") Note: xmlDoc.load("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") is working fine. The save is working fine in local but not when on server and request from client. Kindly suggest me the possible solution to it. hello i am trying to include the following following in my code, but it keeps creating an error. i need to know the correct place to include the function.many thanks Code: CODE ---------------------------------------- <script type="text/javascript"> $(function() { $("#flex1").flexigrid( { url: 'staff.php', dataType: 'json', colModel : [ {display: 'ID', name : 'id_con', width : 40, sortable : true, align: 'left'}, {display: 'Name', name : 'name_con', width : 150, sortable : true, align: 'left'}, {display: 'Email', name : 'email_con', width : 150, sortable : true, align: 'left'}, {display: 'Phone', name : 'phone_con', width : 250, sortable : true, align: 'left'}, {display: 'Mobile', name : 'mobile_con', width : 150, sortable : true, align: 'left'}, {display: 'Fax', name : 'fax_con', width : 150, sortable : true, align: 'left'}, {display: 'Notes', name : 'notes_con', width : 250, sortable : true, align: 'left'} ], buttons : [ {name: 'Edit', bclass: 'edit', onpress : doCommand}, {name: 'Delete', bclass: 'delete', onpress : doCommand}, {separator: true} ], searchitems : [ {display: 'Name', name : 'name_con'}, {display: 'Email', name : 'email_con', isdefault: true}, {display: 'Position', name : 'position'} ], sortname: "name_con", sortorder: "asc", usepager: true, title: "Staff", useRp: true, rp: 10, showTableToggleBtn: false, resizable: false, autowidth: true, autoheight: true, singleSelect: true } ); }); FUNCTION ----------------------------------------------------------- function doCommand(com, grid) { if (com == 'Edit') { $('.trSelected', grid).each(function() { var id_con = $(this).attr('id_con'); id_con = id_con.substring(id_con.lastIndexOf('row')+3); alert("Edit row " + id_con); }); } else if (com == 'Delete') { $('.trSelected', grid).each(function() { var id_con = $(this).attr('id_con'); id_con = id_con.substring(id_con.lastIndexOf('row')+3); alert("Delete row " + id_con); The suspect line is the following $('.leaveClan').attr('id') = <?php echo $id; ?>; the span with the class (there is only one) leaveClan is on the main page, and that line of javascript is on a page being called by AJAX within that page. Can anyone see why that is causing an error? Let me know if you need to see any more of the code hello, The following code is causing firefox to crash: Code: if (!e) { alert("!e"); e = window.event; } alert("before"); var x = e.pageX; alert("after"); By 'crash', I mean it just stops running. It doesn't give me an error message or shut down the browser, it just quits reading the script. I get the alert box "!e" and "before" but I don't get anything for "after". At the line var x = e.pageX; it seems to die. This seems to happen anytime I use e, for example e.clientX, e.screenX, e.type, etc. This doesn't occur in IE. Anyone know what the problem is? I was told by Kunena developers that the issue is that when I insert an image or a video in my forum, it is loading after javascript loads setting the height to "static". Unfortunately they didn't know a fix, so I came here I guess the script is causing the forum articles to overflow the height by exactly the same number of pixels as the image/video. When the page is reloaded, the issue is corrected, but its really annoying for visitors who don't know to reload the page. Not to sound like a big dummy or anything, but I have gone through every file in my template and have found absolutely no "static" scripts, so any help in tracking it down would be greatly appreciated as I am not a javascript guru. I have tried preloading the images, but it had no effect. An example of the overflow issue can be found here https://christian-knowledge.com/inde...id=22&id=25#25 At the moment I have changed the overflow value on that particular section to "auto" to get around it for the time being, but its definitively not a good fix. Thank you for your time and I really appreciate any assistance or advice on how to fix this I've been writing calculators with Javascript for over ten years and using the "to.Exponential" function for formatting and rounding. Recently, it is causing a problem for me. Here is a very shortened version of a calculator on which I am working: http://www.1728.com/count.htm This works fine for the first time it is activated but it doesn't work for the second (or any number of additional) times. (Keep clicking "calculate" and you'll see what I mean.) I didn't want to link to the original calculator (because of its size) but the "to.Exponential" function causes yet another problem in that one. When the count ('ct') is equal to five or six, the program stops working. Any help with this would be greatly appreciated. I have a server that when restarted emails from the code below every single time. I would like to know what I can use in the code below to regonize the restart and bypass the email send piece in BOLD below. Any help will be greatly appreciated. now = currentDateTime() if (statusInOverride != lastOverrideValue) or (overrideTime != lastOverrideTime) lastOverrideValue = statusInOverride lastOverrideTime = overrideTime if statusInOverride.value == true overrideStopTime = now overrideStopTime.minute = now.minute + overrideTime // Also send an email overrideHours = overrideTime / 60 mailSend(address, suiteName + " Overridden", suiteName + " has been overridden for " + overrideHours + " hours."); else mailSend(address, suiteName + " Override Canceled", suiteName + " has canceled their override. There was " + remainingTime + " remaining."); remainingTime.duration = 0 endif endif if statusInOverride.value == true remainingTime.duration = delta(now, overrideStopTime) endif So, this is my last problem. If I can nail this, then the website will be completely AJAX driven, and will be spectacular. It took me a while to figure out just how to ask the question. lol Now it is really simple. 1) When I hit the button, in the simplified example below, the website sends a code to the server. 2) The server then re-writes the "xyz.js" JavaScript file with a new array of values. Is there any way to re-retrieve that JavaScript file, from the server to make it the current "xyz.js" rather than the old one that loaded on the client originally. I can get a new XML data file and re-submit that to the website, but how do I re-retrieve the new JavaScript code? Code: <html> <head> <script src="xyz.js" type="text/javascript"></script> </head> <body> <button onclick="onload();">Change</button> </body> </html> Hey I've created a new homepage for my cubecart shop, but when I upload it it doesn't display, I've check all resources and they are all being loaded Here is the site: http://www.genyx.co.uk/ Here is what it is supposed to look like: http://www.genyx.co.uk/Genyx%20Theme/html/index.htm Can anyone help? Hello I am using PlainAjax. http://coolpenguin.net/plainajax/?p=examplespostdata Here is my code and it is not working if i called from Javascript function. Code: <script type="JavaScript" src="plainajax.js"></script> <script language="JavaScript" > function openWin() { ....... ....... ....... var selval = selectedValue.toString(); // Dynamic value variable document.formlist.myval.value = selval; // stored to hidden variable var cn = document.getElementById( "itsme" ).childNodes; // Get all the nodes var myresult = new Array(); // declare result array plainajax.request('respurl: req_php.php; resultloc: myresult; paramloc: cn;'); Window.open("req_php.php"); } </script> <html> <div id="itsme"> <input type="hidden" name="myval" id="myval" value=""> </div> </html> req_php.php ========= Code: <?php echo "value from html = ".$_REQUEST['myval']."<br>"; ?> But i am not able to get any value in my php program. What i did wrong in this? or is anyother way to pass the variable from Javascript (except pass thru url query string, this is not secure) Thanks I'm attempting to pull the hidden iframe file upload trick using javascript. I've go my form file upload and iframe fine, but I can't figure out what to do when it gets server side. There seems to be relatively no documentation on how to handle uploaded files in server-side javascript. Ideas? I'm at a loss.
Hi, I have a script that writes to an IFRAME, it writes dynamically and then needs to reload it server side. Anybody knows how to do it? I'm joining the code of my attempt but it appears to be reloading the IFRAME on the client side therefore causing an activeX error since I am running this in FireFox: PHP Code: var frTraductionID = document.getElementById("frTraduction"); frTraductionID = (frTraductionID.contentWindow) ? frTraductionID.contentWindow : (frTraductionID.contentDocument.document) ? frTraductionID.contentDocument.document : frTraductionID.contentDocument; var x=frTraductionID.document.getElementById("hCount").value; var ifrm = document.getElementById("ifUPDATE"); ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument; ifrm.document.open(); ifrm.document.write('<scr' + 'ipt language=javascript type="text/javascript" runat=server>'); ifrm.document.write('var fso = new Active' + 'XObject("Scripting.FileSystemObject"); '); ifrm.document.write('var f = fso.OpenTextFile("' + sFileName + '", 2, true); '); for (var i=0;i<x;i+=1) { var sString=""; sString +="f.WriteLine('"; sString +=frTraductionID.document.getElementById("h"+i).value; sString +='="'; sDetail=frTraductionID.document.getElementById("d"+i).value.replace('"', ' '); sDetail=sDetail.replace("'", "`"); sString +=sDetail; sString +='"'; sString +="')"; sString +="; "; alert("i = " + i + " str = " + sString); ifrm.document.write(sString); } ifrm.document.write("f.Close();"); ifrm.document.write("</Scr" + "ipt>"); ifrm.document.close(); document.getElementById('ifUPDATE').contentWindow.location.reload(true); any help would be appreciated. I would like to use functionality similar to DirectoryInfo and FileInfo using server-side javascript in ASP.NET, but neither are recognized. What are the equivalents, if they exist, in javascript?
Hi, I am working on the following page: http://www.reutin-international.com/redirect.html There is a news script on the right-handside which rotates news items (a kind of scroller). Locally this works without any problems, but once I've uploaded it to the hosting server this doesn't work. There is no javascript error sign. I have double checked with the hosting and they support javascript by default. If anyone has any ideas it'd be appreciated! Thanks! Hi, I have created a global navigation includes document. Unfortunately the drop down menus that are part of the navigation aren't working. They worked fine when they were part of the page, but now that they are separated from the page as includes the drop down menus don't appear in my test site (posted to a web server). All other content in the includes file appears and works. Any ideas? Thanks for your help. I have the following JavaScript (see below). The script requests an XML file from the server and displays it on the page. The script works fine when the requested XML file is stored on the same server as the script. The problem is when I try requesting an XML file from an external server such as the National Weather Service. I get an error. If I take the XML file from the National Weather Service and save it to my server it works. Why can't I use my script to request XML files stored on external servers? Thanks in advance for any help. Javascript Code Code: window.onload = initAll; var xhr = false; function initAll() { document.getElementById("makeTextRequest").onclick = getNewFile; document.getElementById("makeXMLRequest").onclick = getNewFile; } function getNewFile() { makeRequest(this.href); return false; } function makeRequest(url) { if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { if (window.ActiveXObject) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } } if (xhr) { xhr.onreadystatechange = showContents; xhr.open("GET", url, true); xhr.send(null); } else { document.getElementById("updateArea").innerHTML = "Sorry, but I couldn't create an XMLHttpRequest"; } } function showContents() { if (xhr.readyState == 4) { if (xhr.status == 200) { if (xhr.responseXML && xhr.responseXML.contentType=="text/xml") { var outMsg = xhr.responseXML.getElementsByTagName("choices")[0].textContent; } else { var outMsg = xhr.responseText; } } else { var outMsg = "There was a problem with the request " + xhr.status; } document.getElementById("updateArea").innerHTML = outMsg; } } HTML Code 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"> <head> <title>My First Ajax Script</title> <script type="text/javascript" src="script01.js"></script> </head> <body> <p><a id="makeXMLRequest" href="http://www.weather.gov/xml/current_obs/KOJC.xml">Request an XML file</a></p> <div id="updateArea"> </div> </body> </html> Hi people, I need help as follows: On the server side I have a php generated session parameter. I need to pass it to javascript on the client side page. I saw on the web the following solution: <script language="JavaScript"> var mySessionVar="<%= Session["MySessionVar"] %>"; </script> I tried it but it did not work. I could not find any explanation of this syntax - will appreciate one. Any suggestions, maybe in another way? Thanks Hi, I have created a site and on one page it uses 2 divs side by side to display text information. in the left hand div it contains 8 links. these links when clicked load up text stored in separate text files and display it in the right hand div. The code below was working when i ran it from my mac but when i try to load it off the webhost it fails to execute. Code: $(document).ready(function() { $("#mc").click(function() { $("#innertext").load('mc.txt'); }); $("#sd").click(function() { $("#innertext").load('sd.txt'); }); $("#ma").click(function() { $("#innertext").load('ma.txt'); }); $("#rtm").click(function() { $("#innertext").load('rtm.txt'); }); $("#cm").click(function() { $("#innertext").load('cm.txt'); }); $("#r").click(function() { $("#innertext").html('r.txt'); }); $("#bp").click(function() { $("#innertext").load('bp.txt'); }); $("#pc").click(function() { $("#innertext").load('pc.txt'); }); }); Code: <div class="wrapper p2"> <ul class="list1 col-1"> <li>> <a href="javascript:void(0);" onclick="function("mc");" id="mc">Consultancy</a></li> <li>> <a href="javascript:void(0);" onclick="function("sd"); id="sd">Strategy</a></li> <li>> <a href="javascript:void(0);" onclick="function("ma"); id="ma">Market Assessment</a></li> <li>> <a href="javascript:void(0);" onclick="function("rtm"); id="rtm">Routes to Market</a></li> </ul> <ul class="list1 col-2"> <li>> <a href="javascript:void(0);" onclick="function("cm"); id="cm">Change management</a></li> <li>> <a href="javascript:void(0);" onclick="function("r"); id="r">Restructuring</a></li> <li>> <a href="javascript:void(0);" onclick="function("bp"); id="bp">Planning</a></li> <li>> <a href="javascript:void(0);" onclick="function("pc"); id="pc">Project management</a></li> </ul> </div> here is a link to the page on the webhost-- http://herkes.host56.com/index-2.html Any ideas to why this does not work? any help is appreciated I need help to make a Server to server connection I already have a server connected to clients, clients send msgs and it echoes back to all of them and now i want when a client sends a msg it echoes on his server and the other server too .. so when any of the clients on any of the servers sends a msg it is broadcasted all over the servers to all clients This is my SERVER code Code: import java.io.*; import java.net.*; public class MultiThreadChatServer { // Declaration section: This part to declare the server socket, client // socket, input stream // and output stream static Socket clientSocket = null; static ServerSocket serverSocket = null; // server can hold up to 10 clients static clientThread t[] = new clientThread[10]; public static void main(String args[]) { int port_number = 6000; if (args.length < 1) { System.out.println("Server Started \n" + "Now using port number=" + port_number); } else { port_number = Integer.valueOf(args[0]).intValue(); } // Initialization section: Where I try to open a server socket on the // given port try { serverSocket = new ServerSocket(port_number); } catch (IOException e) { System.out.println(e); } // Create a socket object from the ServerSocket to listen and accept // connections // Open input and output streams for this socket will be created in // client's thread since every client is served by the server in // an individual thread while (true) { try { clientSocket = serverSocket.accept(); for (int i = 0; i <= 9; i++) { if (t[i] == null) { (t[i] = new clientThread(clientSocket, t)).start(); break; } } } catch (IOException e) { System.out.println(e); } } } } // This client thread opens the input and the output streams for a particular // client, // ask the client's name, informs all the clients currently connected to the // server about the fact that a new client has joined the chat room, // and as long as it receive data, echos that data back to all other clients. // When the client leaves the chat room this thread informs also all the // clients about that and terminates. class clientThread extends Thread { DataInputStream is = null; PrintStream os = null; Socket clientSocket = null; clientThread t[]; public clientThread(Socket clientSocket, clientThread[] t) { this.clientSocket = clientSocket; this.t = t; } public void run() { String line; String name; try { is = new DataInputStream(clientSocket.getInputStream()); os = new PrintStream(clientSocket.getOutputStream()); os.println("Enter your name."); name = is.readLine(); os.println("Hello " + name + " you can now start chatting with all the connected chat-mates"); for (int i = 0; i <= 9; i++) if (t[i] != null && t[i] != this) t[i].os.println(".." + name + " has entered the chat room .."); while (true) { line = is.readLine(); if (line.startsWith("/quit")) break; for (int i = 0; i <= 9; i++) if (t[i] != null) t[i].os.println("<" + name + "> " + line); } for (int i = 0; i <= 9; i++) if (t[i] != null && t[i] != this) t[i].os.println("" + name + " has left the chat room .."); os.println("Bye " + name + " .."); // Clean up: // Set to null the current thread variable such that other client // could // be accepted by the server for (int i = 0; i <= 9; i++) if (t[i] == this) t[i] = null; // close the output stream // close the input stream // close the socket is.close(); os.close(); clientSocket.close(); } catch (IOException e) { } ; } } |