JavaScript - Array Based Css Replace Script Failing
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"; } Similar TutorialsI 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 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! Building a javascript shopping cart for an assignment. First time using Javascript so ignore the ****ness of it please Anyway basically I need to replace the qty of an item in an array if the item has already been added to the array. if it hasn't then it adds the normal values to the array. So I assume atm that I have to run an if statement when the function Code: function readInput(prd, qty, prc){ is called that checks in the array before pushing the new values into the array if array contains product name then var id = productarrayID+1 then replace that with the new quantity read in by the form. Quantity in my array is after the product name so I assume productarrayID+1 would give me the qty id variable. So heres the steps, be they correct: 1) get product name from HTML. 2) check if array contains product name. 3) continue with adding to array if product name doesn't exist in array. 4) if array contains product name retrieve id of product name within array. 5) + 1 to the ID to the product name thus giving me the ID for the quantity. 6) run some array.replace with the new id and replace with the quantity. Just wondering if thats a year or no to how that would run. Il post my HTML code but please dont post solutions I would prefer to write the code myself but just checking if the step-by-step process would work thankyou. HTML: Code: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="css\basic.css" /> <script language="JavaScript" src="js/basic.js"></script> <title>Shopping Time</title> <body> <div id="wrapper"> <div id="header"> </div> <div id="content"> <div id="items"> <div id="column"> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper"> <p class="desc" value="Paper"> Product: Paper 1</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £1.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper2"> <p class="desc" value="Paper2"> Product: Paper 2</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £1.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper3"> <p class="desc" value="Paper"> Product: Paper 3</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £1.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> </div> <div id="column"> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper4"> <p class="desc" value="Paper4"> Product: Paper 4</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £2.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper5"> <p class="desc" value="Paper5"> Product: Paper 5</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £1.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper6"> <p class="desc" value="Paper6"> Product: Paper 6</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £1.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> </div> <div id="column"> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper7"> <p class="desc" value="Paper5"> Product: Paper 7</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £1.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper8"> <p class="desc" value="Paper8"> Product: Paper 8</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £1.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> <img src="img/paper1.jpg"> <form name="test"> <input type="hidden" name="prd" value="Paper9"> <p class="desc" value="Paper9"> Product: Paper 9</p> <p class="desc"> <input type="hidden" name="prc" value="1.00"> Price: £1.00</p> <p class="desc"> Select Quantity: <select name="amount" onchange="quantity()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </p> <p class="submit"> <input type="button" onclick="readInput(prd.value, amount.value, prc.value);" name="test" value="Add To Cart" /> </p> </form> </div> </div> <div id="sidebar"> <table border="1px solid black" id="table" rules="ALL" frame="void" class="cart" width="100%"> <tbody> <tr> <th> <p class="cart">Product:</p> </th> <th> <p class="cart">QTY:</p> </th> <th> <p class="cart">Price:</p> </th> <th> <p class="cart">Total:</p> </th> </tr> </tbody> </table> <button onclick="viewshoppingcart('table')" class="button">Update Shopping Cart!</button> </div> </div> <div id="footer"> </div> </body> </html> Script: Code: var cart= new Array(); var down= 0; function readInput(prd, qty, prc){ down = down + 1; var total= prc * qty; cart.push( prd ) cart.push( qty ) cart.push( prc ) cart.push( total ); } var p = 0; var q = 1; var t = 2; var s = 3; function viewshoppingcart(id){ if(!cart[p])return; for(var i = 0; i < down; i++ ) { var tbody = document.getElementById(id).getElementsByTagName("tbody")[0]; var row = document.createElement("tr") var data1 = document.createElement("td") data1.appendChild(document.createTextNode( cart[p] ) ) var data2 = document.createElement("td") data2.appendChild (document.createTextNode( cart[q] )) var data3 = document.createElement("td") data3.appendChild (document.createTextNode( cart[t] )) var data4 = document.createElement("td") data4.appendChild (document.createTextNode( cart[s] )) row.appendChild(data1); row.appendChild(data2); row.appendChild(data3); row.appendChild(data4); tbody.appendChild(row); p = p + 4; q = q + 4; t = t + 4; s = s + 4; } down = 0; } I'll probably be laughed at for this attempt of coding, but all I am trying to do is read an input field, remove the "$" and write the new value in a different input field. Code: function convert_action (form){ var input1=form.input_field1.value; var clean=input1.replace(/$/, ''); form.input_field2.value = clean; } Looks simple, and thought this would work, it kindof does, it just does not strip out the dollar sign... Help would be appreciated...greatly... Hello All, I have a code which works fine for what is does but I want to add in dynamically a new list to the Array...... from an input field. The relevent part of the code reads as this for example........ var step_x_list=new Array("ca1sb2en1pg1itm1","ca1sb2en1pg1itm2","ca1sb2en1pg1itm3") but I need a way to dynamically replace the existing.... "ca1sb2en1pg1itm1","ca1sb2en1pg1itm2","ca1sb2en1pg1itm3" seen above with a new list from an input field which holds the following say....... ca2sb2en2pg1itm1","ca2sb2en2pg1itm2","ca2sb2en2pg1itm3 I have tried various ideas but none seem to be able to inject the new values in the space between the brackets. Any thoughts. Martin. For those just wondering what the code is and want to try it, it is a one piece code which can fire many different functions without requiring lots of individual bits of code to do same. The action usually happens in micro-seconds but I slowed it to a one second count between changes so you can see what is actually happening. Below is a revised code if you want to see it working and also to give an idea about the Array part in which I want to add a different number set. Copy the code and save in notepad as test.html It can be opened as a web page. Remember to change the code tags to the correct script tags Code: var i_x_list=0 function fireFunctionList_x_list() { if (document.getElementById("locate_load_x_list").value == "end" || document.getElementById("locate_load_x_list").value == "undefined"){i_x_list=0;document.getElementById("locate_load_x_list").value=""}else{fireFunctionList_x_list_do()} } function fireFunctionList_x_list_do() { document.getElementById("addto").value="place_"; var step_x_list=new Array("ca1sb2en1pg1itm1","ca1sb2en1pg1itm2","ca1sb2en1pg1itm3","ca1sb2en1pg1itm4","ca1sb2en1pg1itm5","ca1sb2en1pg1itm6","ca1sb2en1pg1itm7", "ca1sb2en1pg1itm8","ca1sb2en1pg1itm9","ca1sb2en1pg1itm10","ca1sb2en1pg1itm11","ca1sb2en1pg1itm12","ca1sb2en1pg1itm13","ca1sb2en1pg1itm14","end") document.getElementById('locate_load_x_list').value=step_x_list[i_x_list] i_x_list=i_x_list+1 document.getElementById("addto").value+=document.getElementById("locate_load_x_list").value; document.getElementById("final_locate_load_x_list").value=document.getElementById("addto").value; document.getElementById("final_locate_load_x_list").value+=document.getElementById("addto2").value; var x_list = document.getElementById("final_locate_load_x_list").value; setTimeout("fireFunctionList_x_list()",1000) var f_x_list = new Function(x_list); f_x_list(); } <BR><BR> <button onclick="fireFunctionList_x_list()">run the function list rotation</button> <BR><BR> <input id="addto" type="text" size=25 value="place_"><BR> <input id="addto2" type="text" size=4 value="()"><BR> <input id="locate_load_x_list" type="text" size=20 value=""><BR> the code fires this function if there<input id="final_locate_load_x_list" type="text" size=25 value=""><BR> Code: function place_ca1sb2en1pg1itm4(){alert("ca1 number4 function dummy run as alert");} Code: function place_ca1sb2en1pg1itm9(){alert("ca1 number9 function dummy run as alert");} Code: function place_ca2sb2en1pg1itm6(){alert("ca2 number6 function dummy run as alert");} Code: function place_ca2sb2en1pg1itm12(){alert("ca2 number12 function dummy run as alert");} I am new to Java/AJAX and I am trying to create a script that will change content of a div. My scenario I am using is an index page with the list.php script included in the div I want content changed in. The list.php script will pull 8 newest titles from mysql and list them in the div. When you click one of the titles it will redirect you to a new page created by story.php. I would like this to be contained inside the div I have currently have the list.php script in. I have looked at several tutorials on AJAX to do this, but they always call a static html page. Since I am not using a static html page I do not think this solution would work for me. How my list.php script works is as follows: PHP Code: // generate and execute query $query = "SELECT id, title, timestamp FROM news ORDER BY timestamp DESC LIMIT 0, 8"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if records present if (mysql_num_rows($result) > 0) { // iterate through resultset // print news titles while($row = mysql_fetch_object($result)) { ?> <b><font size="+2"><a href="story.php?id=<? echo $row->id; ?>"><? echo $row->title; ?></a></b></font> <br> <font size="-2"><center><? echo formatDate($row->timestamp); ?></center></font> <p> <? } } // if no records present // display message else { ?> <font size="-1">No news is bad news</font> <? } How my story.php script works is as follows: PHP Code: // generate and execute query $query = "SELECT title, content, contact, timestamp FROM news WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // get resultset as object $row = mysql_fetch_object($result); // Show me the news if ($row) { ?> <p> <b><? echo $row->title; ?></b> <p> <font size="-1"><? echo nl2br($row->content); ?></font> <p> <font size="-2">Posted on <? echo formatDate($row->timestamp); ?>. By <? echo $row->contact; ?></font> <? } else { ?> <p> <font size="-1">That news post could is not found.</font> <? } If you need more information for this I will provide whatever you need. Can anyone help me out with a script that can redirect based on IP address? I want all of my computers on my LAN, 192.168.1.1-255 to be redirected to a specific page. IE When I type in test.homeip.com it goes to my web server and reads the index.html file. If the IP is in the 192.168.1.0 range it will redirect to 192.168.1.10:80 and if its any other IP it will send it to 192.168.1.11:80 Thanks! I would like to put a script on our website that users could interact with and that would ask a series of questions and based on those questions propose answers. Im surprised I cant find much on the web to help me do this. Does anyone know a PHP script, widget, or template that could provide me this functionality? I just want to be able to input a series of questions and answers and the logical flow and be able to host it on our web server. Anyone know of a script that shows a different page based upon a users IP address? Thanks Hello, I have very little knowledge of javascript, other than modifying existing scripts, and I can't find anything about this particular problem. I need some help on creating a simple script that will display a div ONLY if the user comes from a certain page within the same site. Not sure if that was clear, but let me try with specifics. There is a link to a page called 'Clients' on the 'About Us' page. If a user goes directly to 'Clients', they should have a normal experience. If, however, they come via the 'About Us' page, I want to display a div at the bottom of the page that will take them back to the 'About Us' page. I know how to get a referrer, and I know how to show/hide divs. I just don't know how to combine the two. Can anyone help? Hello, I am trying to get all the div tags in my page into an array but only the tags with the ID "image**". Below is what I came up with but this doesn't seem to work, even after googling a bit I couldn't find any solution. I don't think this should be so hard but I'm very new to JavaScript (tbh programming in general) and can't seem to come up with a solution. Any help or pointers would be greatly appreciated. Code: function divs() { var divs = document.getElementsByTagName('div'); var ImageTags = []; for (i=0; document.getElementsByTagName('div').length; i++) { var div = divs[i]; if (/image[0-9]*/.test(div)) { imageTags.push(div); } } } Hi, Please i am not getting clear understanding of a javascript code to redirect user to a different web page based on the day of the week. Please i have search for many script and not getting clear understanding from their code.I have also try several code myself but nothing good has come from it. Please can someone help me and write a descriptive code for me to understand better.I really plead you and your to help me...but i belief the Lord God will bless you for your time helping me. looking forward to here from you. Thank you. Clement Osei Hi, what would be the best way to have a hidden array of possible text directed at a textarea and then if something is not within that array "onfocus", a certain select option is chosen within that form? Thanks i am trying to make an online graphing calculator with javascript. dont ask how because i dont know. but there is an annoying error in a do...while loop. although it should break out of the loop when the |'s (absolute value signs) are replaced with Math.abs( and ). here is the code. Code: var initec = function(){ var rg = { } ; rg.matc = false; rg.i = 0; rg.change = function(equ){ if (typeof(equ) != "string"){ alert('Equation must be a string'); return; } alert("starting equation: "+ equ); rg.i = 0; do{ rg.matc = equ.match(/\|/); if(rg.i === 0){ equ.replace(/\|/, " Math.abs("); rg.i = 1; alert("1 "+equ); } else { equ.replace(/\|/, " ) "); rg.i = 0; alert("0 "+equ); } }while(rg.matc) alert("finished equation: " + equ); } return rg; } rg=initec(); rg.change("|8/x+7|-2"); the last 2 lines and the alerts are for debugging. as you can see, it is not finished. but still, it should work. If you want preload images on several pages of your site do you need to preload all images of your whole site on each page or only the images of the actual page?
Hi guys, i am trying to work with google maps api my issue is with creating an array of markers count the number of marker, and then if it equal two, issue an error msg. i wrote some code, but that doesn't work obviously. and my question is how do i write that code in javascript ? GEvent.addListener(map, 'click', function (overlay, latlng) { if (placeMarker.length < 2) { pendingLatLng = latlng; setTimeout("settleClick()", 225) } else { message("You can only select 2 points."); } }); a sample click event which looks like the line below does work. what am i doing wrong ?: google.maps.event.addListener(map, 'click', function (event) {placeMarker(event.latLng); }) 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 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 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); } } |