JavaScript - Window.clipboarddata.getdata("text") Is Undefined
Hi,
window.clipboardData.getData("text") is giving undefined on remote server(unix). When deployed locally(windows xp) it is coming giving correct value. In both cases the brower is IE running on windows xp. Is there anything wrong in the way I am reading the clipboard data? Similar TutorialsHello, recently I have been to many government websites where I have noticed that the programmer has used window.open() method in JavaScript to link to different pages instead of using <a> tags! I was just getting curious to know whether it is normal or has it been used due to security concerns(if any, I don't know)? Any comments? I need to do an input text validation which include opening parenthesis and closing parenthesis, what I need to validate is the opening parenthesis match with closing parenthesis. Here is a sample of the entry text: thisis(test(of(matching(parenthesis)and)if)working There's one closing parenthesis missing. I would like to warn the user to correct it before submit, but not quite sure how to do it with javascript. Please advice. Thanks JT I guess this case applies to both popup windows opened by window.open() and by showModalWindow(). I have two buttons in popup window, "Cancel" and "Save". If the user clicks either button, there is a "process" at parent window before close() at popup being called. The problem now is, if the user click the "X" sign at top right corner of that popup window, how to trigger the "process"? I think I can do nothing in popup window since the closure is unexpected programmatically. Can I put some kind of listener in parent window to detect if popup is closed? Hi, In my "main.js" file I need to create a new window with a button. If the button clicked a function in the "main.js" file is called. I tried the following, but new window does not see the function in the "main.js" file. function create_new_window() { my_window = window.open ("","mywindow1","status=1,width=350,height=150"); my_window.document.write('<H1>My Window ...</H1>'); my_window.document.write('<form><input type="button" value="Submit" onClick="submitData();"/></form>'); .... } function submitData() { ... } Hi, My webpage can work normally in IE but not in Safari(e.g. when I clicked on some buttons like 'Delete' button, the page opened in Safari stays the same while it should delete the object chosen). When I tried debugging on Safari, after clicking the 'update' button, this message error appeared: "TypeError: Result of expression 'this.form.fireEvent' [undefined] is not a function". I believe this code makes the incompatability between the 2 browser: Code: function DeleteClick() { var frmSWO = document.getElementById("form"); var answer = confirm("Do you really want to delete?") if (answer != 0) { frmSWO.action = "/domsWeb/mtd/doms/web/operation/eDepotMNR/controller/manageWorkOrder/DeleteJobOrImage.do"; frmSWO.method = "post"; this.form.fireEvent('onsubmit'); frmSWO.submit(); } } Any suggest how should I amend the script for it to work on 2 browser concurrently? Thanks all! Hi everyone, I'm using a JavaScript to upload multiple files, namely this one: http://valums.com/ajax-upload/ The script has the ability to post additional parameters to the server, by calling the function setParams Code: var doktyp = "default"; var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader-scope'), action: 'uploads.php', // additional data to send, name-value pairs debug: true, onSubmit: uploader.setParams ({ dateityp: getCheckedValue(document.forms['doktyp'].elements['dateityp']), comment: jQuery('#dateityp').val() }) }); Without the onSubmit: part the script works well and does as it's supposed to, but with it FireBug reports "uploader is undefined" und the script seizes to function. Now JavaScript istn't my strong suit, so I have been reading up on this for the last two hours, tried calling that function from a different place, tried to modify it, but no luck; the error remains the same (or slightly different; if I point at the class in question directly, the function doesnt work...). I would appreciate any advice you could give. Here is a clip of code from a script project im working on. Now my document.getElementsByTagName is returning a "undefined" value. Can anyone tell me whats wrong with my code? Code: <a href="http://www.anotherrandomsite.com" style="text-decoration: none; color: #EDDBAF; font-size: 16px;"> <center style="margin-left: 10px; margin-right: 10px;"> <font style="color: #EDDBAF; font-size: 16px;" id="title"></font> </center> </a> <li id="name"><a http="http://www.randomsite.com" style="color: blue;">John Doe</a></li> <script type="text/javascript"> var pname = document.getElementById('name').getElementsByTagName('a'); //now if i remove the ".getElementsByTagName('a')" it will actually work, but it also includes the <a> tag thats within the <li> tag, which i dont want. document.getElementById('title').innerHTML=pname.innerHTML; </script> I've been testing my site in firefox and safari and everything was a OK. Now IE is telling me that "pagetracker" is undefined and its not taking me to the other links on my site. Also the content on the first page is not showing up in IE. jonathaneiger.com Code: <script type="text/javascript"> function loadText() { var t1=setTimeout("document.getElementById('data').innerHTML='<center><img style=\"margin-top:30px;\" src=\"loading.gif\" /></center>'",0000); var t2=setTimeout("document.getElementById('data').innerHTML='THEPAGE'",6000) } </script> The above is in the header, and I'm calling it in the html. Code: <script type="text/javascript"> document.write(loadText()); </script> in the page it displays properly, but then it also says "undefined" not sure why? anyone have any ideas? Alright so this is my problem. I'm using ajax to validate my form without refreshing the page. Everything works but the message part of my contact form. The name, email, and subject get passed but the message returns back as "undefined". I've looked through some of the older posts with the keyword being undefined and I didn't really find anything that helped. I've been trying to get this working for like days now an I'm sure its something really simple and right under my nose. So I will post my html for the form and the validation code. I want to thank all who help. Here is the HTML Code: <div id="forminfo"> <form name="contact" method="post" action=""> <dl> <dt id="name"><label for="fName" class="">Name</label></dt> <dd><input type="text" class="text" name="fName" id="fName" style="width:200px; height:20px;" /></dd> <label class="error" for="fName" id="fName_error">This field is required.</label> <dt id="eMail"><label for="email" class="">Email</label></dt> <dd><input type="text" class="text" name="email" id="email" style="width:200px; height:20px;" /></dd> <label class="error" for="email" id="email_error">This field is required.</label> <dt id="subject"><label for="subject">Subject</label></dt> <dd><input type="text" size="8" maxlength="40" name="subject" id="subj" style="width:200px; height:20px;" class="text" /></dd> <label class="error" for="subject" id="subj_error">This field is required.</label> <dt id="comments">Message</dt> <dd><textarea name="memo" class="text2" id="memo"></textarea></dd> <dd><input type="submit" class="button" id="submit" name="submit" value="" /></dd> </dl> </form> </div><!--forminfo--> Here is the JavaScript/AJAX Code: $(function() { $('.error').hide(); $('input.text-input').css({backgroundColor:"#FFFFFF"}); $('input.text-input').focus(function(){ $(this).css({backgroundColor:"#FFFFFF"}); }); $(".button").click(function() { // validate and process form // first hide any error messages $('.error').hide(); var name = $("input#fName").val(); if (name == "") { $("label#fName_error").show(); $("input#fName").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("label#email_error").show(); $("input#email").focus(); return false; } var subject = $("input#subj").val(); if (subject == "") { $("label#subj_error").show(); $("input#subj").focus(); return false; } var comments = $("input#memo").val(); if (comments == "") { $("input#memo").focus(); return false; } var dataString = 'fName='+ name + '&email=' + email + '&subj=' + subject + '&memo=' + comments; //alert (dataString);return false; $.ajax({ type: "POST", url: "bin/process.php", data: dataString, success: function() { $('.formContainer').html("<div id='message'></div>"); $('#message').html("<h2>Contact Form Submitted!</h2>") .append("<p>I will be in touch soon.</p>") .hide() .fadeIn(1500, function() { $('#message').append("<img id='checkmark' src='images/check.png' />"); }); } }); return false; }); }); runOnLoad(function(){ $("input#fName").select().focus(); }); Hello. My goal is to write a form input to the cookie. The rest of the cookie works, and if I declare var user_email = 'muppet';, the content becomes "muppet". However, if I try to do something more dynamic, like var user_email = document.addform.email it becomes "undefined". I tried adding ".value" to that as well. I have been at this since yesterday, and tried solutions like running a setEmail() function, or getElementById. Here is my cookie writing function, which I call with onsubmit="createCookie('userEmail',user_email,365)" Code: <script type="text/javascript"> var user_email = 'muppet'; function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } </script> The form looks like this: Code: <form name="addform" action="http://formmail.dreamhost.com/cgi-bin/formmail.cgi" method="post" onsubmit="createCookie('userEmail',user_email,365)"> <input type="hidden" name="required" value="email" /> <input type="hidden" name="redirect" value="http://www.saverally.com/confirmed.html" /> <input type="hidden" name="recipient" value="addme@saverally.com" /> <input type="hidden" name="subject" value="add to list" /> Your Email: <input type="text" name="email" name=email size="20" value="" /> <input type="submit" value="Send"/> </form> Thanks! Hiya, I would like to ask your help regarding this damned error message that comes out only in Internet Explorer and makes impossible to submit the form. The javascript code is: Code: function checkForm() { var cname, cspouse, cemail, chphone, ccellular, caddress, ccity, cstate, czip, cpets, cvolunteer, cadditional; with(window.document.volApplForm) { cname = Name; cspouse = Spouse; cemail = Email; chphone = HomePhone; ccellular = Cellular; caddress = Address; ccity = City; cstate = State; czip = Zip; cpets = Pets; cvolunteer = Volunteer; cadditional = Additional; } var ALERT_TITLE = "Oops!"; var ALERT_BUTTON_TEXT = "Close"; if(document.getElementById) { window.alert = function(txt) { createCustomAlert(txt); } } function createCustomAlert(txt) { d = document; if(d.getElementById("modalContainer")) return; mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div")); mObj.id = "modalContainer"; mObj.style.height = document.documentElement.scrollHeight + "px"; alertObj = mObj.appendChild(d.createElement("div")); alertObj.id = "alertBox"; if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px"; alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px"; h1 = alertObj.appendChild(d.createElement("h1")); h1.appendChild(d.createTextNode(ALERT_TITLE)); msg = alertObj.appendChild(d.createElement("p")); msg.innerHTML = txt; btn = alertObj.appendChild(d.createElement("a")); btn.id = "closeBtn"; btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT)); btn.href = "#"; btn.onclick = function() { removeCustomAlert();return false; } } if(trim(cname.value) == '') { alert('Please enter your name'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cname.focus();} return false; } else if(trim(cemail.value) == '') { alert('Please enter your email'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cemail.focus();} return false; } else if(!isEmail(trim(cemail.value))) { alert('Email address is not valid'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cemail.focus();} return false; } else if(trim(chphone.value) == '') { alert('Please enter your valid phone number'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); chphone.focus();} return false; } else if(trim(ccellular.value) == '') { alert('Please enter valid cell phone number'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); ccellular.focus();} return false; } else if(trim(caddress.value) == '') { alert('Please enter your valid address'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); caddress.focus();} return false; } else if(trim(ccity.value) == '') { alert('Please enter your city'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); ccity.focus();} return false; } else if(trim(cstate.value) == '') { alert('Please enter valid state name'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cstate.focus();} return false; } else if(trim(czip.value) == '') { alert('Please enter valid zip code'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); czip.focus();} return false; } else if(trim(cvolunteer.value) == '') { alert('Please fill in all fields'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cvolunteer.focus();} return false; } else if(trim(cadditional.value) == '') { alert('Please fill in all fields'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cadditional.focus();} return false; } else { cname.value = trim(cname.value); cspouse.value = trim(cspouse.value); cemail.value = trim(cemail.value); chphone.value = trim(chphone.value); ccellular.value = trim(ccellular.value); caddress.value = trim(caddress.value); ccity.value = trim(ccity.value); cstate.value = trim(cstate.value); czip.value = trim(czip.value); cpets.value = trim(cpets.value); cvolunteer.value = trim(cvolunteer.value); cadditional.value = trim(cadditional.value); return true; } } function trim(str) { return str.replace(/^\s+|\s+$/g,''); } function isEmail(str) { var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn |bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk| dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs |gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr| kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum |mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr |pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf |tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za| zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i; return regex.test(str); } And when trying to submit the form, I get the error message: Code: Line: 177 Character: 4 Code: 0 Error Message: 'undefined' is null or not an object URL: https://localhost/ruff/scripts/validationVol.js Do you have an idea what could be the problem? As I checked line 177, it seems to be OK. I checked the web, but didn't find anything related to this message in a situation like this. Thanks in advance for your comments. Whenever this function sorts itself out, the value of the variable I want ends up "undefined". It starts here in my code with this link. $sort is the variable that's giving me trouble. If I echo it here, it works correctly. Code: <a id='showMoreLink' onclick='showMorePosts($showMoreCount,$sort)'>Show more...</a> Here is snippets of the showMorePosts function Code: function showMorePosts(str,sortBy) { xmlhttp.open('GET','ajaxQueries.php?sort='+sortBy+'&q='+str,true); xmlhttp.send(); } And here is where I am echoing $sort in ajaxQueries.php, and getting "undefined". Note that $q works just as it should. (All I can think is q is an integer, and sort is a string) PHP Code: $q=$_GET['q']; $sort=$_GET['sort']; echo $sort.$q; Hey guys! i'm trying to put a search box on my web site but every time i type any thing, it opens the search results on the same page. How can i make the search contents open on a fresh page?
Hi everyone, I was hoping you could help me with a faily easy question. I was asked to edit some script and I figured out most of it, however I can't seem to be able to make the links in my java script menu open in new pages. Any help would be appreciated. Below is a copy of the script. It's a very long script, so I just sent a section of it. Pleasse scroll down to the bottom to see where the links are (ex. http://www.korg.com, etc) Thank you, Paul. <!-- function mmLoadMenus() { if (window.mm_menu_1107110519_0) return; window.mm_menu_1107110519_0 = new Menu("root",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107110519_0.addMenuItem("Parts Department","location='/e/support/accessories.html'"); mm_menu_1107110519_0.addMenuItem("Warranty Registration","location='/e/support/warranty.html'"); mm_menu_1107110519_0.addMenuItem("F.A.Qs","location='/e/support/faqs.html'"); mm_menu_1107110519_0.addMenuItem("Tutorials & Guides","location='/e/support/tutorials.html'"); mm_menu_1107110519_0.addMenuItem("Related Products","location='/e/support/related_products.html'"); mm_menu_1107110519_0.addMenuItem("Downloads","location='/e/support/downloads.html'"); mm_menu_1107110519_0.addMenuItem("Newsletter","location='/e/support/newsletter.html'"); mm_menu_1107110519_0.addMenuItem("Owner’s Manual","location='/e/support/manual_request.html'"); mm_menu_1107110519_0.addMenuItem("Korg Proview Request","location='/e/support/literature_request.html'"); mm_menu_1107110519_0.addMenuItem("Suggested Retail Prices","location='/e/products/pricelists.html'"); mm_menu_1107110519_0.hideOnMouseOut=true; mm_menu_1107110519_0.menuBorder=1; mm_menu_1107110519_0.menuLiteBgColor='#2a4960'; mm_menu_1107110519_0.menuBorderBgColor='#000000'; mm_menu_1107110519_0.bgColor='#000000'; window.mm_menu_1107105559_0_1 = new Menu("KORG",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_1.addMenuItem("KORG.com","location='http://www.korg.com'"); mm_menu_1107105559_0_1.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_1.hideOnMouseOut=true; mm_menu_1107105559_0_1.menuBorder=1; mm_menu_1107105559_0_1.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_1.menuBorderBgColor='#000000'; mm_menu_1107105559_0_1.bgColor='#000000'; window.mm_menu_1107105559_0_2 = new Menu("VOX",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_2.addMenuItem("VOX.co.uk","location='http://www.voxamps.co.uk'"); mm_menu_1107105559_0_2.addMenuItem("VOX online Newsletter","location='http://www.f3studios.com/vox'"); mm_menu_1107105559_0_2.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_2.hideOnMouseOut=true; mm_menu_1107105559_0_2.menuBorder=1; mm_menu_1107105559_0_2.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_2.menuBorderBgColor='#000000'; mm_menu_1107105559_0_2.bgColor='#000000'; window.mm_menu_1107105559_0_3 = new Menu("SAMSON",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_3.addMenuItem("SAMSON WIRELESS","location='http://www.samsontech.com/products/brandpage.cfm?brandID=1'"); mm_menu_1107105559_0_3.addMenuItem("SAMSON AUDIO","location='http://www.samsontech.com/products/brandpage.cfm?brandID=2'"); mm_menu_1107105559_0_3.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_3.hideOnMouseOut=true; mm_menu_1107105559_0_3.menuBorder=1; mm_menu_1107105559_0_3.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_3.menuBorderBgColor='#000000'; mm_menu_1107105559_0_3.bgColor='#000000'; window.mm_menu_1107105559_0_3a = new Menu("HARTKE",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_3a.addMenuItem("HARTKE","location='http://www.samsontech.com/products/brandpage.cfm?brandID=3'"); mm_menu_1107105559_0_3a.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_3a.hideOnMouseOut=true; mm_menu_1107105559_0_3a.menuBorder=1; mm_menu_1107105559_0_3a.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_3a.menuBorderBgColor='#000000'; mm_menu_1107105559_0_3a.bgColor='#000000'; window.mm_menu_1107105559_0_4 = new Menu("LIGHTSNAKE",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_4.addMenuItem("LIGHTSNAKE","location='http://www.soundtech.com'"); mm_menu_1107105559_0_4.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_4.hideOnMouseOut=true; mm_menu_1107105559_0_4.menuBorder=1; mm_menu_1107105559_0_4.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_4.menuBorderBgColor='#000000'; mm_menu_1107105559_0_4.bgColor='#000000'; window.mm_menu_1107105559_0 = new Menu("root",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_1,"location='http://www.korg.com'"); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_2,"location='http://www.voxamps.co.uk'"); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_3,"location='http://www.samsontech.com'"); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_3a,"location='http://www.samsontech.com/products/brandpage.cfm?brandID=3'"); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_4,"location='http://www.soundtech.com'"); mm_menu_1107105559_0.addMenuItem("Promotions","location='/e/promotions.html'"); mm_menu_1107105559_0.addMenuItem("Suggested Retail Prices","location='/e/products/pricelists.html'"); mm_menu_1107105559_0.hideOnMouseOut=true; mm_menu_1107105559_0.childMenuIcon="/images/nav/arrows.gif"; mm_menu_1107105559_0.menuBorder=1; mm_menu_1107105559_0.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0.menuBorderBgColor='#000000'; mm_menu_1107105559_0.bgColor='#000000'; mm_menu_1107105559_0.writeMenus(); } // mmLoadMenus() //--> I am trying to manipulate a an image gallery that functions well. Now, I have the ability to pull information from a user's preference pannel and need to place it in the an href="" // And other information in each of the "src" | "url" | "alt". Any ideas would be truly helpful. This is what I am working with at the moment and it doesn't work (obviously because it is adding code inside a span). Here is what I am starting from: [CODE] var title01Span = document.getElementById('title01Span'), //Finds the id that I want prefs = new gadgets.Prefs(), // Pulls from the user's preferences yourtitle01 = prefs.getString("title01"); // Pulls the correct string from those preferences title01Span.innerHTML = yourtitle01; // replaces the span.id with that text but I need to be able to do this in the src / href / url / etc. [CODE] Thank you so much! I seriously could use as much help as possible! Hi, my employer found a shell html file with just a script on it as in the title PHP Code: <script type="text/javascript"> window.location="/controlPanel" </script> Can anyone tell me what this might be doing? He said he doesnt even remember uploading this file to his site. I tried googleing the code, but didn't find specifically what it is. I think maybe its a redirect of sorts, but not sure, and definately not sure why we have it or how we have it. Thanks for any help! I had some code written for me. Basically it outputs something like this based on user input: Code: <span>name 1 - <a href=\"test1b\" rel="nofollow" target=\"_blank\">test1a</a> - $12</span><br/> <span>name 2- <a href=\"test2b\" rel="nofollow" target=\"_blank\">test2a</a> - $24</span><br/> What it used to look like: Code: /** * @FUNCTION: finalize :: PUBLIC * This is a shorter version of the codes you * had before and also have a more faster speed */ $.finalize = function(g) { /* Setting global variables */ var i,k,d,p,j,n=0,t=[],f=[],preview=false,addbr='',addExtra='', o=document.getElementsByTagName('div'), s=document.getElementById(g), /* Creating getName function */ getName=function(o){ /* Setting getName global variables */ var i,n= ['Motherboard','CPU','RAM','Video Card', 'Hard Drive','Power Supply','Case', 'Operating System','Other'] ; /* Obtaining and returning the result */ for(i=0;i<n.length;i++){if(n[i].toLowerCase()== o.toLowerCase().replace('_',' ')){return n[i];}} }; /* Obtaining the full total */ $.findTotal(); /* Looping through all active boxes */ for(i=0;i<o.length;i++) { /* Splitting current box class by spaces */ k = o[i].className.split(' '); /* Looping through each class items */ for(j=0;j<k.length;j++) { /* Checking if this item is equal to itemBox */ if(k[j] == 'itemBox') { /* Setting d as the current box that contains itemBox in the class */ d = document.getElementById(o[i].id); /* If d's display is not empty and doesn't equal none */ if(d.style.display !== '' && d.style.display !== 'none') { /* Setting up the loops global variables */ var h=d.getElementsByTagName('input'),name='', text='',link='',quantity='',price='',run=false; /* Looping through each of the inputs and obtaining the correct information */ for(p=0;p<h.length;p++) { /* If current input name contains [name] and is not disabled */ if(h[p].name.indexOf('[name]') !== -1 && !h[p].disabled) { /* Obtaining the correct name for the current box */ name = getName(h[p].name.match(/computer\[(\w+)\]\[name\]/)[1]); /* IF current input value is not empty and Setting the variable as the current inputs value */ if(h[p].value !== '') {text = ' '+h[p].value;run = true;} /* If current input name contains [link] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[link]') !== -1 && !h[p].disabled && h[p].value !== '') { /* If variable text is not empty output the forum URL and Custom text string */ if(text.substr(1) !== '') {link = ' <a href="'+h[p].value+'" rel="nofollow" target="_blank">'+text.substr(1)+'</a>';} /* If variable text is empty output the forum URL string */ else {link = '" rel="nofollow" target="_blank">'+h[p].value+'</a>';} run = true; /* If current input name contains [quantity] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[quantity]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ quantity = ' ('+parseInt(h[p].value)+')'; run = true; /* If current input name contains [price] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[price]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ var add = (text !== '' | link !== '' | quantity !== '')?' -':''; price = add+' $'+parseInt(h[p].value); run = true; } } /* Checking if link is not empty, if it is check if text is not empty and if that is then set as empty */ link = (link !== '')?link:(text !== '')?text:''; name = (run)?name+' -':''; /* Add this full string to the global array */ f[n] = "<span>"+name+''+link+''+quantity+''+price+"</span><br/>"; /* Add 1 to the number n */ n++; /* Allowing preview */ preview = true; } } } } if(total && f.join('') !== '') {addExtra+="\n\n<p>Total Price: $"+total+"</p>";} /* If s exists set the innerHTML as the full f array imploded by \n at the end of each array item */ if(s) {for(i=0;i<f.length;i++){if(f[i]!==''){t[i]=f[i];}}s.value=t.join("\n")+addExtra;} /* Updating the total */ $.findTotal(); /* Checking if preview is true */ if(preview && f.join('') !== '') { /* Displaying the preview to the user */ $.preview('display','preview'); } else { /* Hiding the preview from the user */ $.preview('hide','preview'); } }; But for some reason, when I change the part in red, it starts saying undefined: Code: /** * @FUNCTION: finalize :: PUBLIC * This is a shorter version of the codes you * had before and also have a more faster speed */ $.finalize = function(g) { /* Setting global variables */ var i,k,d,p,j,n=0,t=[],f=[],preview=false,addbr='',addExtra='', o=document.getElementsByTagName('div'), s=document.getElementById(g), /* Creating getName function */ getName=function(o){ /* Setting getName global variables */ var i,n= ['Speakers 1','Speakers 2','AMP','Source Comp. 1', 'Source Comp. 2','Source Comp. 3','Other'] ; /* Obtaining and returning the result */ for(i=0;i<n.length;i++){if(n[i].toLowerCase()== o.toLowerCase().replace('_',' ')){return n[i];}} }; /* Obtaining the full total */ $.findTotal(); /* Looping through all active boxes */ for(i=0;i<o.length;i++) { /* Splitting current box class by spaces */ k = o[i].className.split(' '); /* Looping through each class items */ for(j=0;j<k.length;j++) { /* Checking if this item is equal to itemBox */ if(k[j] == 'itemBox') { /* Setting d as the current box that contains itemBox in the class */ d = document.getElementById(o[i].id); /* If d's display is not empty and doesn't equal none */ if(d.style.display !== '' && d.style.display !== 'none') { /* Setting up the loops global variables */ var h=d.getElementsByTagName('input'),name='', text='',link='',quantity='',price='',run=false; /* Looping through each of the inputs and obtaining the correct information */ for(p=0;p<h.length;p++) { /* If current input name contains [name] and is not disabled */ if(h[p].name.indexOf('[name]') !== -1 && !h[p].disabled) { /* Obtaining the correct name for the current box */ name = getName(h[p].name.match(/computer\[(\w+)\]\[name\]/)[1]); /* IF current input value is not empty and Setting the variable as the current inputs value */ if(h[p].value !== '') {text = ' '+h[p].value;run = true;} /* If current input name contains [link] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[link]') !== -1 && !h[p].disabled && h[p].value !== '') { /* If variable text is not empty output the forum URL and Custom text string */ if(text.substr(1) !== '') {link = ' <a href="'+h[p].value+'" rel="nofollow" target="_blank">'+text.substr(1)+'</a>';} /* If variable text is empty output the forum URL string */ else {link = '" rel="nofollow" target="_blank">'+h[p].value+'</a>';} run = true; /* If current input name contains [quantity] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[quantity]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ quantity = ' ('+parseInt(h[p].value)+')'; run = true; /* If current input name contains [price] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[price]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ var add = (text !== '' | link !== '' | quantity !== '')?' -':''; price = add+' $'+parseInt(h[p].value); run = true; } } /* Checking if link is not empty, if it is check if text is not empty and if that is then set as empty */ link = (link !== '')?link:(text !== '')?text:''; name = (run)?name+' -':''; /* Add this full string to the global array */ f[n] = "<span>"+name+''+link+''+quantity+''+price+"</span><br/>"; /* Add 1 to the number n */ n++; /* Allowing preview */ preview = true; } } } } if(total && f.join('') !== '') {addExtra+="\n\n<p>Total Price: $"+total+"</p>";} /* If s exists set the innerHTML as the full f array imploded by \n at the end of each array item */ if(s) {for(i=0;i<f.length;i++){if(f[i]!==''){t[i]=f[i];}}s.value=t.join("\n")+addExtra;} /* Updating the total */ $.findTotal(); /* Checking if preview is true */ if(preview && f.join('') !== '') { /* Displaying the preview to the user */ $.preview('display','preview'); } else { /* Hiding the preview from the user */ $.preview('hide','preview'); } }; well title says it all i have a search form, and the default value is "enter text here" when the user click the submit button, i would like to check if the value of my text input is "enter text here" and if it is, then don't submit the form (popup a warning or something) how can i do that? thanks a lot! Hello, I run a online gaming website, and I'm having problems with certain websites iframing our games. Actually I'm ok with iframing, as long as they include the banner ad located just beneath our games. But often times unscrupulous webmasters will iframe only the game, preventing us from generating any revenue from the banner ad (and costing us additional bandwidth charges). I'm hoping to find a way to detect the dimensions of the iframe, so that I may dynamically resize the game, in order to include the banner ad within the iframe. Does anybody know how to extract the "height" and "width" attribute values from an <iframe> tag sitting on a different site? Regards, Steve |