JavaScript - Javascript Failing On Windows 7 Machine
Hi - I have an ASP.Net 4.0 solution that runs fine on a Windows 2008 server. However, I've just been given a new Windows 7 64-bit machine to use as my development machine and I'm having a problem with one of my aspx pages. This page has some javascript on it, which runs fine, but then it gets to the following code:
Code: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> This not code that I've written; it's code that's generated client-side that I see as I'm debugging my app in Visual Studio 2010 (trying to figure out what the $^#$ is going on). At any rate, once this code completes, the app does nothing. The debugger should take me to some server-side code, but it doesn't. It just sits there. The result is that the page doesn't do what it's supposed to do (no inserts to databases, no success messages, no nothing). As I said, this problem is restricted to my W7 64-bit machine; it runs fine on W2008. Other pages with javascript in the same solution work fine on my W7 machine. I found a post (http://dopostback.net/index.php/net-...anel-problems/) that discusses a similar issue within an UpdatePanel, but I'm not using UpdatePanel. My page does have hidden controls on it, but so do other pages that work just fine. Does anyone know what could be causing this? Thanks! Similar TutorialsHi to all, I'm having a problem deciphering this script. This is a 3 image slot machine script(I guess) Can someone explain to me how this code works? And how can I make it show the same result? here it goes: Quote: var chaosMachineSpinCtr = 0; function chaos_machine_attempt(params) { params.on_start(params); $.post(params.post_url, {}, function(data) { var ret = JSON.parse(data); spinResults = ret.spin_results; chaosMachineSpinCtr = 0; chaos_machine_spin_slot(params, ret); }); } function chaos_machine_spin_slot(params, ret) { spinResults = ret.spin_results; if(chaosMachineSpinCtr < 25) { $('#'+params.ul_id+' li[rel=1] > img').attr('src', params.images[array_rand(params.images)]); } else if(chaosMachineSpinCtr == 25) { $('#'+params.ul_id+' li[rel=1] > img').attr('src', spinResults.images[0]); } if(chaosMachineSpinCtr >= 25 && chaosMachineSpinCtr < 50) { $('#'+params.ul_id+' li[rel=2] > img').attr('src', params.images[array_rand(params.images)]); } else if(chaosMachineSpinCtr == 50) { $('#'+params.ul_id+' li[rel=2] > img').attr('src', spinResults.images[1]); } if(chaosMachineSpinCtr >= 50 && chaosMachineSpinCtr < 75) { $('#'+params.ul_id+' li[rel=3] > img').attr('src', params.images[array_rand(params.images)]); } else if(chaosMachineSpinCtr == 75) { $('#'+params.ul_id+' li[rel=3] > img').attr('src', spinResults.images[2]); } chaosMachineSpinCtr++; if(chaosMachineSpinCtr <= 75) { setTimeout(function() {chaos_machine_spin_slot(params, ret);}, 50); } else { params.on_end(params, ret); } } Hi - firstly, apologies for the generic nature of this question, I'm sure I will have some more specific questions later into this project! I'm a complete newbie to javascript and would like to know if it is possible to create a vertical spinning bar like on a fruit machine, that contains a number of images. I would like the bar to have the following behaviour. 1. on the mouse being above the centre point of the bar, the images scroll upwards 2. on the mouse being below the centre point of the bar, the images scroll downwards 3. the further you are from the centre point - the faster the bar scrolls 4. when you hover an image - the bar stops, the image lightens a shade and a link is displayed below the image. My initial thought is to contain the bar in a div and have javascript actions applied to it depending on the mouse position within the div - the actions will change the positions of the image contained in the div. Would be great if anyone knew some code that does a similar thing - or could give me some pointers to start me off. Thanks : ) I have an javascript coding issue with regards to a tabbed menu. The code is supposed to hide the unselected divs and show the selected div, but all divs are showing and no tab is selected when the page initialises. The source code is viewable he http://www.kenaani.co.uk I was following this tutorial: http://www.elated.com/articles/javascript-tabs/ Which works fine in this example: http://www.elated.com/res/File/artic...ript-tabs.html I have tried commenting out the other scripts, and the divs still show on the page, so I don't think its a conflicting issue. Am hoping that someone can spot whatever is going wrong. I am trying to use a javascript plugin for jQuery library that transforms a regular select html element into a dropdown checkbox list (Dropdown Check List, see http://code.google.com/p/dropdown-check-list/), however I believe that the prototype library that I am loading immediately after the jquery library is still conflicting with it somehow even though I modified my code to reflect the following changes (which is supposed to allow the use of prototype with jquery): http://docs.jquery.com/Using_jQuery_...ther_Libraries (Including jQuery before Other Libraries) My code (in a cold fusion environment, which should be irrelevant) looks like this: Code: <html> <head> <SCRIPT LANGUAGE="JavaScript" SRC="js/jQuery/jquery.js" TYPE="text/javascript"></SCRIPT> <SCRIPT LANGUAGE="JavaScript" SRC="js/prototype.js" TYPE="text/javascript"></SCRIPT> <script language="javascript" type="text/javascript" src="js/jQuery/ui.core.js"></script> <script language="javascript" type="text/javascript" src="js/jQuery/ui.dropdownchecklist.js"></script> <script language="javascript" type="text/javascript"> jQuery(document).ready(function() { jQuery("#cbo_status").dropdownchecklist({ width: 200, maxDropHeight: 120 }); }); </script> </head> <body> <select id="cbo_status" name="cbo_status" multiple="multiple"> <option value="-1">All</option> <option value="1" SELECTED>Assigned</option> <option value="2" SELECTED>In Progress</option> <option value="3" SELECTED>Complete</option> <option value="4" SELECTED>Verified Resolved</option> <option value="5" SELECTED>Will not be addressed</option> <option value="6" SELECTED>Wishlist</option> </select> </body> </html> When I run the debugger, here's the error I'm still receiving: Error: Object doesn't support this property or method (pointing to the line below, character 3) jQuery("#cbo_status").dropdownchecklist({ width: 200, maxDropHeight: 120 }); Does anyone have any idea why this might still be failing? Hi, I am wondering, is there any method that can copy a file(.pdf) from server and paste it in the local drive while the file(.pdf) in the local drive is reading by users ? P/S : In Windows, the users are not allow to edit or replace the file if it's being read. Requirements : The users must read the file in local drive after copy from the server. 2 methods been tried : 1. I tried the method which make the javascript to close the browser(IE) first, then copy and replace the file but after the browser is close, everything stopped. 2. Then, I also tried to reopen the file from server first, then only I copy the file from server and replace the local file again but the problem exists again. Even though the local file is closed and file from server is open, the system just doesn't allow me to copy and replace the local file. Why ? Can anyone give me some suggestion or advice please ? Really need help on this issue. I currently have a popup window that works fine but while that window is up on top and I click on another link that opens another window the popup goes behind that window. How do I code to get the popup window to always stay on top no matter what window I open up with the code I have below: Code: <script language="javascript" type="text/javascript"> function test() { setTimeout("self.focus()",3000) } function open_new_window() { //new_window = open("","hoverwindow","width=300,height=200,left=10,top=10"); new_window = window.showModelessDialog("","hoverwindow","width=300,height=200,left=10,top=10"); new_window.focus(); // open new document new_window.document.open(); // Text of the new document // Replace your " with ' or \" or your document.write statements will fail new_window.document.write("<html><title>JavaScript New Window</title>"); new_window.document.write("<body onBlur = "test();" bgcolor=\"#FFFFFF\">"); new_window.document.write ("Week 1 Question".bold()); new_window.document.write("<table><tr><td>Is there a role of process owner in your organization? If not, how will you overcome this challenge? Why do you need process owners as a Lean Six Sigma Green Belt Project Leader?</td></tr></table>"); new_window.document.write("<br />"); new_window.document.write("</body></html>"); // close the document new_window.document.close(); } // This is the function that will close the // new window when the mouse is moved off the link function close_window() { new_window.close(); } </script> Dear friends, I am using a Javascript which perfectly worked in all relevant browsers, including IE6 and IE7. Its advantage has been to be able to specify the window-size + to decide, whether there should be scrollbars or the option to resize it. It is also fully standards-compliant. It opens a new popup window and is triggered via the rel="popup" or rel="popup nofollow" attributes in the specified external links, e.g.: Code: <a href="http://www.codingforums.com/" rel="popup">CodingForums</a> <a href="http://www.codingforums.com/" rel="popup nofollow">CodingForums</a> The code however does not do its job in IE8. It follows the link, but does so in the old window, not a new popup window, and thus recurs to standard behavior of links. Here is the Javascript-Code, included in the header: Code: var properties = { width: 900, height: 450, scrollbars: 'yes', resizable: 'yes' }; function popup(){ var link = this.getAttribute( 'href' ); var prop_str = ''; for( prop in properties ){ prop_str = prop_str + prop + '=' + properties[prop] + ','; } prop_str = prop_str.substr( 0, prop_str.length - 1 ); var newWindow = window.open( link, '_blank', prop_str ); if( newWindow ){ if( newWindow.focus ) newWindow.focus(); return false; } return true; } function setupPopups(){ var links = document.getElementsByTagName( 'a' ); for( var i=0; i<links.length; i++ ){ if( links[i].getAttribute( 'rel' ) && (links[i].getAttribute( 'rel' ) == 'popup' || links[i].getAttribute( 'rel' ) == 'popup nofollow')) links[i].onclick = popup; } } window.onload = function(){ setupPopups(); } Since I am not an expert, I would greatly appreciate help to make this efficent code workable in IE8. Thanks in advance! CodeMat I am currently designing a website for our public library. I have added a card catalog search bar on the side of every page. Our catalog software company has supplied the code. After embedding it, I previewed each page to make sure it was working properly. At the time, it worked fine. Since then, I have added other elements to the homepage such as a Twitter feed and a Flickr slideshow. Now, when I attempt to search in the catalog search bar on the homepage, it opens two tabs, but only in Firefox. Our IT person from the software company suggested I make a copy of the page and strip the code down to see what the problem is. After doing this, I have made no headway. Even with the catalog as the only code left on the page, other than text, it still opens two tabs. The following is the code embedded on the homepage: Code: <div> <script type='text/javascript'> function gotoserver() { sn = document.getElementById('server').value; redirecturl = 'http://webopac.infovisionsoftware.com/stephenville/default.aspx?Title='+sn; window.open(redirecturl) //document.location.href=redirecturl; } </script> <input type='text' name='server' id='server' /> <input type='submit' id='mySearch' value='Go' onclick='javascript:gotoserver();' /> </div> I would appreciate any advice given. Thank you for your time. Hello Can anyone help with the following problem On the following page http://www.stroudskittles.co.uk/signingon.html I have a Body onload event (to load the chained Menu) and a windows.onload event (to load the IFrame Ticker) If I open the page in Internet explorer both scripts function; however in Firefox I'm having problems. The Chained Menu works, however the IFrame Ticker does not display. Both events ahave ben placed on the boady tag. Can anyone advise how I can get both to display in Firefox Can anyone Hey I'm trying to make a slot machine effect in JS - i had an ajax example but was far too complicated to manipulate to communicate with my server so im working from ground up. The way ive done it is simple html and a submit button. But i want the submit button to first create a "rolling through the images" affect like a slot machine does - then stop left to right in that order (basically like a slot machine does). Now this is beyond what i know in JS but i then also want it to know the result of the images store them into an array and push it to my PHP so i can process it on my server. Is this even possible ? And has any one ever tried such a thing because im stuck but really wish to make this for my gaming website. Hope you can help! I'm doing this project for class and I got to a point where i am stuck and need some help on how to move forward, I don't want straight up answers but some advice or some code to get me started would be much appreciated. Thanks. This is what i need to do with what I have While a smart casino owner knows better than to allow negative bankrolls, most casinos are not above extending personal loans to gamblers who are down on their luck. Augment your slots.html page so that it has capabilities for extending loans to the player when they run out of money. Your page should have an additional text box keeping track of the player's debt (initially $0). Instead of just alerting the player when they try to play with no money, the page should give the user the option to obtain a loan. Use a select box for this with options for a $1, $5, $10, or $20 loan. The loan should only be available when the user is out of money, so you will need to initially set the disable attribute of the select box to "true" in order to disable it (see the snippet below for a starting point). When the user runs out of money, you can enable the select box by setting this attribute to "false". And this is what I have... Code: <html> <!-- This page simulates a slot machine. --> <!-- ================================================= --> <head> <title> Online Slots </title> <script type="text/javascript" src="http://dave-reed.com/book/random.js"> </script> <script type="text/javascript"> bankroll=20; bankroll=parseFloat(bankroll); loanctr=0; loanctr=parseFloat(loanctr); function DoSpin() // Assumes: the page contains an image (slot1) // Results: displays a random spin as the slot1 image { if (bankroll == 0) { alert ("You have no money left. Consider taking out a loan."); } else { var pick; pick = RandomOneOf(["cherry.jpg", "lemon.jpg", "bar.jpg", "donut.jpg"]); document.getElementById('slot1').src = "http://dave-reed.com/book/Images/" + pick; var picktwo; picktwo = RandomOneOf(["cherry.jpg", "lemon.jpg", "bar.jpg", "donut.jpg"]); document.getElementById('slot2').src = "http://dave-reed.com/book/Images/" + picktwo; var pickthree; pickthree = RandomOneOf(["cherry.jpg", "lemon.jpg", "bar.jpg", "donut.jpg"]); document.getElementById('slot3').src = "http://dave-reed.com/book/Images/" + pickthree; if (pick == picktwo && pick == pickthree) { alert ("Winner!"); bankroll = bankroll + 1; } else { bankroll = bankroll - 1; } } } </script> </head> <body> <div style="text-align:center"> <img id="slot1" alt="slot image" border=2 src="http://dave-reed.com/book/Images/cherry.jpg" /> <img id="slot2" alt="slot image" border=2 src="http://dave-reed.com/book/Images/cherry.jpg" /> <img id="slot3" alt="slot image" border=2 src="http://dave-reed.com/book/Images/cherry.jpg" /> <br /><br /> <input type="button" value="Click to Spin" onclick="DoSpin(); document.getElementById('earnings').value = bankroll;" /> <br /><br /> <input type = "text" id= "earnings" size = "10" value= "" onfocus="blur();"/> <br /><br /> Take out a loan of <select id="loan" disabled="true" onchange="document.getElementById('loan').value = loanctr;"> <option selected="selected" value=""></option> <option value="1">1</option> <option value="5">5</option> <option value="10">10</option> <option value="20">20</option> </select> dollars. <br /><br /> <input type = "text" id= "loan" size = "10" value= "" onfocus="blur();"/> </div> </body> </html> Hi Everyone, I'm trying to allow a user to select an XML file so that my javascript can parse it and create some pins for a google map. It works fine in Firefox, and by using FireBug I can see that the file is being accessed as expected. IE on the other hand tells me that "'files.0' is null or not an object" on line 68 of address-locator.php... PHP 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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Address Locator</title> <style type="text/css"> #map_canvas { width:690px; height:400px; float: left; clear: right; margin: 0px auto 10px 20px; } </style> <script src="http://www.google.com/jsapi"></script> <script type="text/javascript"> var map = null; var geocoder = null; var establishmentList; // holds the XML list of all the establishments var mapPins = []; // holds a listing of all the map pins google.load('maps', '3', { other_params: 'sensor=false' }); google.setOnLoadCallback(gmapInit); // initialize the google map function gmapInit() { var latlng = new google.maps.LatLng(42.204799,-111.619917); // 45.332245,-99.507536 center of north america var myOptions = { zoom: 4, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } // includes all the information needed to create a pin with a pop up window function mapPin(pinName, pinAddress, pinPhone, pinWebsite, pinLat, pinLng, geocodeSuccess){ this.pName = pinName; this.pAddress = pinAddress; this.pPhone = pinPhone; this.pWebsite = pinWebsite; this.pLat = pinLat; this.pLng = pinLng; this.success = geocodeSuccess; } // gets the lat and lng of an address and adds a pin to the mapPins array. function getLocation(theName, theAddress, thePhoneNumber, theWebsite){ /* geocoder = new google.maps.Geocoder(); geocoder.geocode({'address': theAddress}, function(results, status){ if (status == google.maps.GeocoderStatus.OK) { mapPins.push(new mapPin(theName, theAddress, thePhoneNumber, theWebsite, results[0].geometry.location, true)); } else { mapPins.push(new mapPin(theName, theAddress, thePhoneNumber, theWebsite, 0, 0, false)); alert("Geocode was not successful for the following reason: " + status); } }); */ // remove after working mapPins.push(new mapPin(theName, theAddress, thePhoneNumber, theWebsite, 42.204799, -111.619917, true)); // end removing code } /* loadAddressFile() * opens an XML file which contains descriptions (names), addresses, phone numbers, * and websites for a business and loads the pertetinent information into the global * variable establishmentList. Starts the call chain to have the data processed */ function loadAddressFile() { // open the file selected by the user var finput = document.getElementById("userAddressFile"); var theFile = finput.files[0]; if (theFile) { var fileReader = new FileReader(); fileReader.onload = function(e){ var xmlDoc; // parse (or load) the xml into xmlDoc. if (window.DOMParser){ parser = new DOMParser(); xmlDoc = parser.parseFromString(e.target.result,"text/xml"); } else { // Internet Explorer xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.loadXML(e.target.result); } // listing of the establishments establishmentList = xmlDoc.getElementsByTagName("establishment"); processEstablishment(0, 1000); } fileReader.readAsText(theFile); } else { alert("Failed to load file"); } } // checks to see if the index parameter is less than the length of the list of establishments and processes the establishment at that index in the list if it is. function processEstablishment(index, delay){ if(index < establishmentList.length){ // data from the XML file var theName = establishmentList[index].getElementsByTagName("name")[0].textContent; var theAddress = establishmentList[index].getElementsByTagName("address")[0].textContent; var thePhoneNumber = establishmentList[index].getElementsByTagName("phone")[0].textContent; var theWebsite = establishmentList[index].getElementsByTagName("website")[0].textContent; // get the current addresses geocoding and add the pin to the list getLocation(theName, theAddress, thePhoneNumber, theWebsite); // check to see if the attempt was successfull - if it was not and we are denied our data - increase the hold time and retry the previous attempt if(!mapPins[index].success){ index--; delay += 5000; } // attempt (or re-attempt) the next establishment window.setTimeout(function() { processEstablishment(index+1, delay); document.getElementById("data").innerHTML += mapPins[mapPins.length-1].pName + "<br />"; }, delay); } } </script> <!-- open the file of addresses if it exists and create a javascript array of the addresses --> </head> <body> <!-- This page is set up to allow the user to load an XML file which contains information about businesses and creates the data required to locate that business on a map --> <div id="map_canvas"></div> <div style="clear:left"> <div style="float:left"> <!-- User the file type to allow the user to select the file, then pass this information to javascript via accessing userAddressFile via document.getElementById("userAddressFile") in loadAddressFile() above --> <form id="addresses" action="address-locator.php" method="post" enctype="multipart/form-data"> Select file: <input name="userAddressFile" id="userAddressFile" type="file" /> <input value="Upload" type="button" onclick="loadAddressFile()" /> </form> </div> <div id="data" style="clear:left"></div> </div> </body> </html> and a sampling of the XML file I'm loading: Code: <?xml version="1.0" encoding="UTF-8"?> <barList> <establishment> <name>21-Seven Bar and Grill</name> <address>217 E Street,Davis, CA</address> <phone>530.757.1733</phone> <website>http://www.myspace.com/21seven_davis</website> </establishment> <establishment> <name>Beach Hut Deli</name> <address>109 E Street, Davis, CA</address> <phone>530.758.7873</phone> <website>http://www.beachhutdeli.com/</website> </establishment> <establishment> <name>Bistro 33 Davis</name> <address>226 F Street, Davis, CA</address> <phone>530.756.4556</phone> <website>www.bistro33.com</website> </establishment> </barList> I've spent the entire afternoon in Goo-gle-land - so any help is most appreciated! If I've missed anything or you have any questions please let me know. Thanks in advance! Dave. I have this script that works in IE: Code: var xmlhttpInk; var inkdivID; var inkholdID; function addInkOpt(iside,ivalue) { inkdivID="ink"+iside+ivalue; inkholdID="ink"+iside+"hold"; var divExist=document.getElementById(inkdivID); if (divExist==null) { xmlhttpInk=GetXmlHttpObject(); if (xmlhttpInk==null) { alert ("Browser does not support HTTP Request"); return; } var url="/scripts/addink.php"; url=url+"?q="+iside+"&k="+ivalue; url=url+"&sid="+Math.random(); xmlhttpInk.onreadystatechange=InkChange; xmlhttpInk.open("GET",url,true); xmlhttpInk.send(null); } } function InkChange() { if (xmlhttpInk.readyState==4) { var newDiv=document.createElement("div"); newDiv.id=inkdivID; var objToInserBefore=document.getElementById(inkholdID); newDiv.innerHTML=xmlhttpInk.responseText; objToInserBefore.parentNode.insertBefore(newDiv,objToInserBefore); } } Here's the PHP file for it: PHP Code: mysql_select_db($database_geQuote, $geQuote); $query_inkList = "SELECT * FROM Ink ORDER BY Ink.InkID"; $inkList = mysql_query($query_inkList, $geQuote) or die(mysql_error()); $row_inkList = mysql_fetch_assoc($inkList); $totalRows_inkList = mysql_num_rows($inkList); $iside=$_GET["q"]; $k=$_GET["k"]; $ivalue=$k+1; echo "<p>Ink:"; echo "<select name='Ink".$iside."Data[".$k."][InkID]' class='dropMenu' onchange='addInkOpt(".$iside.",".$ivalue.")'>"; echo "<option value='NULL'></option>"; do { echo "<option value='".$row_inkList['InkID']."'>".$row_inkList['InkDesc']."</option>"; } while ($row_inkList = mysql_fetch_assoc($inkList)); $rows = mysql_num_rows($inkList); if($rows > 0) { mysql_data_seek($inkList, 0); $row_inkList = mysql_fetch_assoc($inkList); } echo "</select>Desc:"; echo "<input name='Ink".$iside."Data[".$k."][InkDesc]' type='text' class='inkdesc' maxlength='25' /><input type='hidden' name='Ink".$iside."Data[".$k."][InkID".$iside."]' value='' /></p>"; mysql_free_result($inkList); However, THIS script does not: Code: var xmlhttpStock; function getJobStock(str) { xmlhttpStock=GetXmlHttpObject(); if (xmlhttpStock==null) { alert ("Browser does not support HTTP Request"); return; } var url="/scripts/jobstock.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlhttpStock.onreadystatechange=JobStockChange; xmlhttpStock.open("GET",url,true); xmlhttpStock.send(null); } function JobStockChange() { if (xmlhttpStock.readyState==4) { document.getElementById("jobStock").innerHTML=xmlhttpStock.responseText; } } and it's PHP file: PHP Code: $q=$_GET["q"]; mysql_select_db($database_geQuote, $geQuote); $query_StockList = "SELECT Stock.StockName, Stock.StockID FROM Stock WHERE Stock.StockWeightID = ".$q." ORDER BY Stock.StockName"; $StockList = mysql_query($query_StockList, $geQuote) or die(mysql_error()); $row_StockList = mysql_fetch_assoc($StockList); $totalRows_StockList = mysql_num_rows($StockList); do { echo "<option value='".$row_StockList['StockID']."'>".$row_StockList['StockName']."</option>"; } while ($row_StockList = mysql_fetch_assoc($StockList)); $rows = mysql_num_rows($StockList); if($rows > 0) { mysql_data_seek($StockList, 0); $row_StockWList = mysql_fetch_assoc($StockList); } mysql_free_result($StockList); it should be the same thing, they're both using HTTP Requests, but the "getJobStock" script just returns no options, but ONLY in IE. In all other browsers PC or MAC it works fine. Could someone please help me figure out what the problem is? I'm attempting to integrate a rich-text mail form and use PHPMailer to send HTML email to a Godaddy email account. The rich-text editor script is the WizzyWig one. (Original can be found Here) Location of form: http://www.westmichiganconcerts.com/contact.html Too much code to post here from all the different files involved, so I saved a version of each file as a TXT file, with it's original extention in brackets before it for easier code viewing (with the exception of the contact.html file above: Involved files: [.js]Rich-Text Editor: /scripts/whizzywig_61.txt [.js]File that spawns preview window: /scripts/load.txt [.php]File called by form action: test_mail.txt [.php]PHPMailer: /lib/PHPMailer_v5.1/class.phpmailer.txt [.php]Config file: /config.txt [.inc]Include file: MailClass.inc.txt Basic flow is: Customer goes to the Contact Page, then enters in rich text, and clicks "Preview" - this spawns a new window "DEMO" and writes the contents of the WizzyWig Iframe to a hidden field. From there, the customer can click "Submit", and it send the email to a Godaddy email account. Here's the problem: I've got a .replace command in the load.js file that replaces the double quotes with singles. If left as doubles, it completely breaks the code. When that email is received, all single quotes are backslashed(escaped?) ( \') so only portions of the HTML (that don't use quotes) show up. (examples: Highlight, insert image, insert link, spans, etc) I'm not fluent with Javascript, so I've been beating my head against the wall for 5 days now trying to get this to work. It's time to ask for some help lol. I'm not sure where / and in what file is causing this to break. Sent a test HTML email to the same Godaddy email address to make sure it could recieve HTML emails, and it worked fine. Any help would greatly be appreciated!! ~ John P.S.: I know there's browser issues with FF etc - I'll correct that once I can get the basic functionality of the pages to work Hi, I am trying to make a fuinction that, when called, will return the string that is retrned in text form from my php code. This is what i currently have, but it is just failing when it is run, what am i doing wrong? Code: function shortenUrl(url) { var response; var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "http://10.1.1.10/projects/short/?ext&url=" + encodeURIComponent(url), false); xmlhttp.send(null); xmlhttp.onload = function() { var response = xmlhttp.responseText; return response; } return "Failed!"; } alert(shortenUrl("http://www.google.com.au/")); Thanks Edit: ohh, and this is running chrome, so no standards issues I'm not sure whether this is best posted here, or on a google maps api forum, but here goes: I have a site which uses a google map, and works well, like this: http://www.railwaysarchive.co.uk/eve...p?eventID=6684 I have built a version of that page which uses an OS map by default, but allows switching to a google map. It is he http://www.railwaysarchive.co.uk/osm...p?eventID=6684 The script uses a simple toggle as follows: Code: function toggleMap() { // toggle map div visibility var googlemap = document.getElementById("googlemap"); var OSmap = document.getElementById("OSmap"); if (OSmap.style.display!="block") { // currently hidden, show OSmap.style.display="block"; googlemap.style.display="none"; document.getElementById("maplink").innerHTML= "Switch to Google Map"; } else { OSmap.style.display="none"; googlemap.style.display="block"; document.getElementById("maplink").innerHTML= "Switch to OS Map"; } } I was having trouble getting both maps to load their respective data when one was hidden, so both maps start out with display:block and then the gmap is hidden during the <body onload>. This system works great with Firefox and with Chrome, but in IE if you switch to the google map the tiles don't load. Can anyone help? Relevant code snippets are as follows: Code: <body onload="createOSAccidentSummaryMap(52.6566359591919, -3.14070984721184, 7); createAccidentSummaryMap(52.6566359591919, -3.14070984721184, 'accident', 13); toggleMap();"> function createAccidentSummaryMap(dblLatitude, dblLongitude, enumType, lngZoom) { // creates a map with a single event marker, map type controls and full zoom controls // and centers it on the event coordinates if (GBrowserIsCompatible()) { // checks for compatible browser map = new GMap2(document.getElementById("googlemap")); map.addControl(new GSmallZoomControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl()); map.setCenter(new GLatLng(dblLatitude, dblLongitude), lngZoom); map.enableDoubleClickZoom(); map.setMapType(G_HYBRID_MAP); var icon = createEventIcon(enumType); var point = new GLatLng(dblLatitude, dblLongitude); var marker = new GMarker(point, icon); map.addOverlay(marker); } } I'm hoping someone can help correct a small problem with this script, which is intended to highlight particular text strings. Background: The script is being used at a MediaWiki site, and is adapted from a working script from Wikipedia (highlightmyname.js). The original script highlights the logged-in user's username (represented by wgUserName). I've made a copy of the script, which you can see in full here, and adapted it to work on a pre-defined array of names, adding: Code: var Admin; var ArrayAdmins = ['Adam', 'Axiomist', 'Matt', 'Steve']; for (Admin in ArrayAdmins) I also replaced each instance of wgUserName with ArrayAdmins[Admin] The problem: is that, instead of highlighting all instances of every element in ArrayAdmins, only the last element listed ('Steve') is being used. So my question is, what change(s) need to be made to apply function highlightmyname to every element in ArrayAdmins? Any help would be hugely appreciated! I've been running into some trouble with a script that just isn't working, and since I'm not encountering any error messages and a similar script on the same page is working just fine, I'm really puzzled. Anyways, here's the code I'm having trouble with: Code: function ShowHide(Numb){ Ident1 = AdIDList[Numb]+"Tx"; Ident2 = AdIDList[Numb]+"Lnk"; if (AdLink[Numb] == "hidden"){ document.getElementById(Ident1).style.height = "355px"; AdLink[Numb] = "visible"; } if (AdLink[Numb] =="visible"){ document.getElementById(Ident1).style.height = "55px"; AdLink[Numb] = "hidden"; } } And here's the page code calling it (The page is assembled via PHP from a database, but I'm grabbing the code from my browser) Code: <a href="#Good ShepherdLnk" id="Good ShepherdLnk" onclick="ShowHide(2);return false;" class="AdLink">Stories</a><br> And, here's a similar bit of code on the same page that is working just as it's supposed to. Code: function hideimage(){ for (Count=0; Count<AdTotal; Count ++){ if (VisPic[Count]=="visible"){ Ident = AdIDList[Count]+"AdB"; document.getElementById(Ident).style.visibility = "hidden"; VisPic[Count]="hidden"; } } } function bigimage(Item){ hideimage(); Ident1 = AdIDList[Item]+"AdB"; document.getElementById(Ident1).style.left="35%"; document.getElementById(Ident1).style.visibility = "visible"; VisPic[Item] = "visible"; } This is my first time writing any JavaScript, so I am not very familiar with the language. I want to make a window be kept at the back, under all other windows. From what I understand, the method to do this would be window.blur(), but I cannot seem to get it to work. Have I misunderstood the functionality, or am I implementing it wrong? The part of the code I have that currently deals with this (or at least tries) is as follows: Code: <BODY onclick="window.blur()" > <img src="imageurl" id="image"></img> </BODY> I've tried a few other events to trigger this (onmouseover, setInterval, etc.) but no way I've tried has worked. So, is blur() the right method to do this? have I done something wrong in the implementation? Any help and guidance is appreciated. Backstory (if it should matter for some reason) : I found a webpage ( here and here ) that generates an image of the Earth as seen from space at a given time and I wanted to place that image, updated on a regular basis, as my desktop image. I looked around for a way to do it, but as far as I could find, there was no way to do it easily in Windows XP. Thus, I am now using Samurize (a program for overlaying graphics etc. at your desktop) to create a browser window that loads a html file that periodically updates the image. While this window cannot be moved and has no borders, it can be selected and if it is selected, the image is brought to the front, overlapping any other windows. I wish to make it such that this cannot happen; I have tried configuring Samurize as well as asking for help on their forums, but no luck so far. Hi. I don't know if anyone here has downloaded the dev edition of windows 8 yet (it was released last night 5:00p, est) I am trying to get jquery to work, but it just wont... I tried simple stuff, but I was hoping someone here knew how. Thanks |