JavaScript - Uncaught Exception: [exception... "component Returned Failure Code: 0x80004003
Double post I'm sorry. Please look at my other one.
Similar TutorialsHey folks. I am needing some help with an error I'm getting from a project I'm working on. First off let me preface this all with the fact that I'm a total javascript noob. I'm really trying to understand what I'm doing wrong. So any help or advice is MORE than welcome. Here's what is happening. I found this code that will duplicate a row in a table and modifiy the name of a input in the row. Well for my purposes I have two different tables I need to work with. (each one idividually) So I changed the code a bit to make it accecpt a variable to use for the table name. (before it was static) and now I'm getting a error. Code: Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER)" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://www.tourandtravelnow.com/admin/scripts/faxPageScript.js :: addRow :: line 14" data: no] This is the old code that would work (only for one of the tables) Code: var clone; function cloneRow(){ var rows=document.getElementById('mytab').getElementsByTagName('tr'); var index=rows.length; clone=rows[index-1].cloneNode(true); var inputs=clone.getElementsByTagName('input'), inp, i=0 ; while(inp=inputs[i++]){ inp.name=inp.name.replace(/\d/g,'')+(index+1); } } function addRow(){ var tbo=document.getElementById('mytab').getElementsByTagName('tbody')[0]; tbo.appendChild(clone); cloneRow(); } onload=cloneRow; and here is my code that doesn't work. Code: var clone; function cloneRow(mytab){ var rows=document.getElementById(mytab).getElementsByTagName('tr'); var index=rows.length; clone=rows[index-1].cloneNode(true); var inputs=clone.getElementsByTagName('input'), inp, i=0 ; while(inp=inputs[i++]){ inp.name=inp.name.replace(/\d/g,'')+(index+1); } } function addRow(mytab){ alert(mytab); var tbo=document.getElementById(mytab).getElementsByTagName('tbody')[0]; tbo.appendChild(clone); cloneRow(mytab); } onload=cloneRow(mytab); So like I said any help would AWESOME! have a great day. Kevin. uncaught exception: Syntax error, unrecognized expression:
Code: :([rel*=qnt_Rc]) I have this code: Code: grpDiv = $$('div:([rel*=' + txt_val + '])'); Which when operaterated on, we have: Code: grpDiv = $$('div:([rel*=qnt_Rc]) This error: uncaught exception: Syntax error, unrecognized expression: Code: :([rel*=qnt_Rc]) Is new. The code in question has been around for about a year and no issues with prototype 1.6.1. Yet we upgraded to 1.7, and this error started showing. any ideas what this could be and how to fix it? thanks I can't get any info from Firebug except that one line, uncaught exception [object Object]. The code fully worked, then I needed to make it dynamically create Sortables from the scriptaculous library based on how many X were in a table in my database, which I've done, and I'm thinking it may be a simple slight parse error of some type, I'm not too good with Javascript, because now my script barely works. I've double checked the script's source code, the PHP variables are exactly what they should be. Code: print<<<HERE Sortable.create('sortlist$box', { tag: 'img', overlap:'horizontal',constraint:false, containment: $list, dropOnEmpty: true, onChange: function(item) { var list = Sortable.options(item).element; if(changeEffect) changeEffect.cancel(); changeEffect = new Effect.Highlight('changeNotification', {restoreColor:"transparent" }); }, onDrop: function(item) { var thing=Sortable.options(item).element.identify(); var anchors = document.getElementById(thing).childNodes.length-2; if(anchors > 20){ alert('This box had 20 creatures in it already, your last action has not been saved.'); window.location.reload(); } else{ new Ajax.Request("saveImageOrder.php", { method: "post", parameters: { data: Sortable.serialize("sortlist$box") } }); } } }); HERE; $box++; } ?> }); </script> if you solve this I'll send ya $10 via paypal I am opening a blank window and writing a javascript on the new window to submit a form. when I execute a line "newWindow.document.write(newwdtxt2);\n\"(3rd line from last) I get an exception and last two lines do not execute. I see this problem only in IE 6, Code works fine with IE 7.Below mention is my code function openWindow(url,name,options) { var aToken = ""; aToken ="2121225434349231132674638921:something"; if(aToken=="") { aToken=document.formEMS.AUTHTOKEN.value; } var newWindow = window.open("", name); if (!newWindow) return false; var newwdtxt = ""; newwdtxt += "<html><head></head>\n"; newwdtxt += "<body>\n"; newwdtxt += "<form name=\"eventForm\" method=\"post\" action="+url+ ">\n"; newwdtxt += "<input type=\"hidden\" name=\"AUTHTOKEN\""; newwdtxt += "value= '";newwdtxt += aToken+"'/>\n"; newwdtxt += "</form>\n"; newwdtxt += "<scr"; var newwdtxt1 = ""; newwdtxt1 += "ipt type=\"text/javascript\" language=\"javascript\">\n"; newwdtxt1 += "window.onLoad=document.eventForm.submit();\n"; newwdtxt1 += "</scr"; var newwdtxt2 = ""; newwdtxt2 += "ipt>\n"; newwdtxt2 += "</body></html>\n"; newWindow.document.write(newwdtxt); alert(newwdtxt); newWindow.document.write(newwdtxt1); alert(newwdtxt1); alert(newwdtxt2); newWindow.document.write(newwdtxt2); alert('wrote newwdtxt2'); return newWindow; } Please help me to figure out what is the problem? What happens in Javascript when you do not catch a thrown exception? Does the script get terminated prematurely? If you try some codes and then catch exception, it should catch the exception when there is. However, if there is a setInterval method in the try clause, then the exception cannot be caught... why??? the following works ( a usual method is invoked in the try clause): Code: <script language="javascript" type="text/javascript"> function invoke() { var i=0; return i.x.y; } try { alert(invoke()); } catch(ex){ alert(ex); } //Any Exception will be caught. </script> if the highlighted line is changed as below (using setInterval method), then it fails... Code: <script language="javascript" type="text/javascript"> function invoke() { var i=0; return i.x.y; } try { setInterval(alert('invoke())',1000); } catch(ex){ alert(ex); } //The Exception will NOT be caught. </script> any idea? thx in advance Hello: I have a Fire Fox 3.5.2 error console message regarding a DHTML script: Error: uncaught exception: [Exceptions: ... "Not enough arguments" nsresult "0x8057001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" Location: "JS frame :: (file path) upHandler :: line 102" no data] The line referenced is: document.removeEventListener('mouseup', upHandler); It is part of a drag function that is applied to a container div. I have successfull used this code block, copied from Orielly's Javascript: The Definitive Guide, 4th Edition in another project. The only real difference is that the code in the working use is div tags hard coded. In the one giving me problems, the div tags are written using document.write() in a function that is called in the body of the document when the page loads. I could supply the code context, but it is several hundred lines. The project is not available at present on the web to surf to but the one project that works is jekillen.com/jekillen/content/web_design/OOP_panel/test_OOP_DEV_ALT.php The code in question is 'beginDrag'. There is a panel called fortune cookie which the user can drag, and a panel called 'Advisory' that the user can also drag around after clicking button labeled 'message'. Any info, suggestions, advice? Thanks in advance. Jeff K Hi All, I am very new to HTML programming and Javascripts. What I am trying to accomplish is I have a radio button "RequiredApprovalYesNo". When the selection is "Yes", I need fields "Approver" and "ApproverEmail" to be required upon submit. I also need to make sure that a selection is made with this radio button of either Yes or No. Here is my HTML code for these three fields and was wondering if someone could show me how to code this script or, give me an example of a Radio button selection resulting in additional fields being required or not. Thank you in advance. Code: <td> <input type="radio" name="RequireApprovalYesNo" id="RequireApprovalYesNo" value="Yes">Yes <input type="radio" name="RequireApprovalYesNo" id="RequireApprovalYesNo" value="No">No </tr> <tr> <td><table width="190" border="0" align="right" cellspacing="0"> <tr> </tr> </table></td> <tr> <td colspan="3"><div align="left"><em><strong><b style= 'color: red;'>If Yes, You Must Enter an Approver with a corresponding Email:</b> </strong></em></div></td> </tr> <tr> <td height="25"><div align="right">Approver:</div></td> <td> </td> <td><input name="Approver" type="text" id="Approver" size="40";"></td> </tr> <tr> <td height="25"><div align="right"> <p>Approver's Email: </p> </div></td> <td> </td> <td><input name="ApprovalEmail" type="text" id="ApprovalEmail" size="40"></td> </tr> <tr> This is a common issue, however, I haven't found anything ( yet ) that points out a solution that I can find in my code. As usual, this site works with every single browser known to man ...........except for any version of IE. I have tried using IE's devel tools to no avail ....though I'm a complete newb, so that isn't saying much. Code??? Here's the section IE complains about: Code: function display(str) { var nodeList = xmlDoc.getElementsByTagName("item"); var cnt = 0; var list = "<hr />"; for(var i=0; i< nodeList.length; i++) { cnt++; // Get vars from XML title = nodeList[i].getElementsByTagName("title")[0].childNodes[0].nodeValue; author = nodeList[i].getElementsByTagName("author")[0].childNodes[0].nodeValue; pubDate = nodeList[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue; call = nodeList[i].getElementsByTagName("call")[0].childNodes[0].nodeValue; cover = nodeList[i].getElementsByTagName("cover")[0].childNodes[0].nodeValue; link = nodeList[i].getElementsByTagName("link")[0].childNodes[0].nodeValue; summary = nodeList[i].getElementsByTagName("summary")[0].childNodes[0].nodeValue; style = nodeList[i].getElementsByTagName("class")[0].childNodes[0].nodeValue; page = nodeList[i].getElementsByTagName("page")[0].childNodes[0].nodeValue; category = nodeList[i].getElementsByTagName("category")[0].childNodes[0].nodeValue; I opened this with Firebug and I see nothing of interest. Specifically, IE complains about line 86: Code: summary = nodeList[i].getElementsByTagName("summary")[0].childNodes[0].nodeValue; Thanks for reading ~ Bub **** UPDATE ***** Well ...it looks like I can't have null values in any elements ( in the xml document ). How do you experts satisfy this requirement in an elegant fashion. Since there is no data for certain elements, I'm looking for a reasonable failover solution. Empty quotes? ..... still experimenting. A script produces the xml file from a database so some elements do not have data for certain child elements. **** UPDATE 2 ***** Using the Unicode non-breaking space in the xml file for empty child elements. Works, but if you have a cooler solution, let me know. Thanks! I have created a basic Javascript function to check that all fields in the contact form that are required have information from the user. It works fine with input fields but not with textarea. Even when I dont insert message into textarea, the script allows to submit the form. I have given the name for textarea "userinput". Could anyone look at the code, and tell me what could possible be wrong with it? Thank you so much. function required() { user_message=document.contact_form.userinput.value; user_name=document.contact_form.name.value; user_email=document.contact_form.email.value; user_phone=document.contact_form.phone.value; if (user_name=="" || user_email=="" || user_phone=="" || user_message=="") { document.getElementById("notification").innerHTML="Please enter all required fields"; return false; } else return true; } Hi Everyone, I'm using the code below to rotate between some testimonials for my website and I realized that it would be better to make the order random rather than always cycling the same each time to be sure the later ones get equal visibility on the home page. I found the code and tweaked it as I needed but I'm not familiar enough with java to know how to add a randomizing component. I'd appreciate any help offered since I hope it's straight forward enough for someone who knows the language well. Thanks a lot! [CODE] var quote=new Array(); quote[0]="An essential tool in preparation for any show. Valuable time is saved, refining vocals much earlier in the process."; quote[1]="Invaluable for learning vocal lines! A brilliantly simple and easy to use interface that saved me hours of time."; quote[2]="MixMyPart saved us almost a week of rehersal time. A brilliant invention. Singers come in less nervous and more focused."; <!-- quote[3]="An invaluble tool for learning vocal lines! Brilliantly simple and easy to use interface that saved me hours of time."; --> var quoteperson=new Array(); quoteperson[0]="Bob Foster, <font color=\"ffffff\">Music Director</font>"; quoteperson[1]="Liam Tobin, <font color=\"ffffff\">Actor</font>"; quoteperson[2]="Shawn Wright, <font color=\"ffffff\">Actor</font>"; <!-- quoteperson[3]="Liam Tobin, <a href=\"website.html\" target=\"_blank\">website.org</a>"; --> var speed=9000; var q=0; function showQuote() { document.getElementById("tst").innerHTML="“" +quote[q]+"”"; document.getElementById("tstperson").innerHTML=quo teperson[q]; q++; if(q==quote.length) { q=0; } } setInterval('showQuote()',speed); Hi there! I'm trying to load up an array of images in HTML5, which will mimic a "video". I've put together code for creating an array of images, which will be drawn by the draw() function, but I'm struggling to find the best way to achieve a setInterval ie make the "video" of images run at 30 fps. At present, when I click the "Draw" button, the images load up, one after the other, just as in a video, but I can't seem to control this loading up speed. Can anyone help? I'm sure I'm very close to a solution! Here is my code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- Created using / Source can be edited via /odexi/edit --> <head> <title>Sandbox</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <style type="text/css" media="screen"> body { background-color: #000; font: 16px Helvetica, Arial; color: #fff; } </style> </head> <body> <input type="button" id="drawButton" value="draw" /> <br/> <canvas id="canvas" width="1000px" height="800px"> </canvas> <script> function init(){ var fps = 1000; // frames / second const timeInterval = 1000 / fps; // milliseconds setInterval(draw,timeInterval); draw(); } function draw() { //var fps = 30; // frames / second //const timeInterval = 1000 / fps; // milliseconds var ctx = document.getElementById('canvas').getContext('2d'), img, i, image_array = [10]; image_array.push("track1.png"); image_array.push("track2.png"); image_array.push("track3.png"); image_array.push("track4.png"); image_array.push("track5.png"); image_array.push("track6.png"); image_array.push("track7.png"); image_array.push("track8.png"); image_array.push("track9.png"); image_array.push("track10.png"); // ... for (i = 0; i < image_array.length; i++) { img = new Image(); img.src = image_array[i]; img.onload = (function(img, i){ return function () { //setInterval(draw, timeInterval); ctx.drawImage(img,0,0); } })(img, i); } } window.onload = function () { document.getElementById('drawButton').onclick = function () { draw(); }; }; </script> </body> </html> Hey all, Firebug gives me the below error message: component.singularize is not a function [Break on this error] var component = component.singularize(); This is what I have: Code: var component = window.location.hash.replace('#', ''); var component = component.singularize(); alert("The component name is " + component); var singularize = function(){ if(!String.prototype.singularize){ String.prototype.singularize = function(){ var context = this; result = ((context.charAt(context.length -1, 1) == 's') ? context.substring(0, context.length - 1) : context); return result; } } } Thanks for any response. This is about http://www.aecp.pt You will see this on the page, and I highlight the problem on the screenshot itself: http://skitch.com/ricardosalta/nk9g4...ub-de-portugal I know by trial and error that the problem is caused by the presence of image galleries like this on the homepage: http://skitch.com/ricardosalta/nk988...ub-de-portugal I use Mac; is there a good tool to find these incompatibilities? Anyway, I appreciate all the help you can gift me with. Any pointers will be much valuable. Thanks. All the best, Tatonka Basically i have made a small gallery with a lightbox feature, and it half works. What i am trying to do is make the lightbox fade out the flash navigation like the rest of the page but it just seems to overlap my lightbox. Any ideas? Here is the link for the webpage: http://www.frozen-shy.webs.com/arts_signatures.html Here is the javascript code: Code: /* Table of Contents ----------------- Configuration Functions - getPageScroll() - getPageSize() - pause() - getKey() - listenKey() - showLightbox() - hideLightbox() - initLightbox() - addLoadEvent() Function Calls - addLoadEvent(initLightbox) */ // // Configuration // // If you would like to use a custom loading image or close button reference them in the next two lines. var loadingImage = 'loading.gif'; var closeButton = 'close.gif'; // // getPageScroll() // Returns array with x,y page scroll values. // Core code from - quirksmode.org // function getPageScroll(){ var yScroll; if (self.pageYOffset) { yScroll = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict yScroll = document.documentElement.scrollTop; } else if (document.body) {// all other Explorers yScroll = document.body.scrollTop; } arrayPageScroll = new Array('',yScroll) return arrayPageScroll; } // // getPageSize() // Returns array with page width, height and window width, height // function getPageSize(){ var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = document.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = windowWidth; } else { pageWidth = xScroll; } arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) return arrayPageSize; } // // pause(numberMillis) // Pauses code execution for specified time. Uses busy code, not good. // Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602 // function pause(numberMillis) { var now = new Date(); var exitTime = now.getTime() + numberMillis; while (true) { now = new Date(); if (now.getTime() > exitTime) return; } } // // getKey(key) // Gets keycode. If 'x' is pressed then it hides the lightbox. // function getKey(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } key = String.fromCharCode(keycode).toLowerCase(); if(key == 'x'){ hideLightbox(); } } // // listenKey() // function listenKey () { document.onkeypress = getKey; } // // showLightbox() // Preloads images. Places new image in lightbox then centers and displays. // function showLightbox(objLink) { // prep objects var objOverlay = document.getElementById('overlay'); var objLightbox = document.getElementById('lightbox'); var objCaption = document.getElementById('lightboxCaption'); var objImage = document.getElementById('lightboxImage'); var objLoadingImage = document.getElementById('loadingImage'); var objLightboxDetails = document.getElementById('lightboxDetails'); var arrayPageSize = getPageSize(); var arrayPageScroll = getPageScroll(); // center loadingImage if it exists if (objLoadingImage) { objLoadingImage.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objLoadingImage.height) / 2) + 'px'); objLoadingImage.style.left = (((arrayPageSize[0] - 20 - objLoadingImage.width) / 2) + 'px'); objLoadingImage.style.display = 'block'; } // set height of Overlay to take up whole page and show objOverlay.style.height = (arrayPageSize[1] + 'px'); objOverlay.style.display = 'block'; // preload image imgPreload = new Image(); imgPreload.onload=function(){ objImage.src = objLink.href; // center lightbox and make sure that the top and left values are not negative // and the image placed outside the viewport var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2); var lightboxLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2); objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px"; objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px"; objLightboxDetails.style.width = imgPreload.width + 'px'; if(objLink.getAttribute('title')){ objCaption.style.display = 'block'; //objCaption.style.width = imgPreload.width + 'px'; objCaption.innerHTML = objLink.getAttribute('title'); } else { objCaption.style.display = 'none'; } // A small pause between the image loading and displaying is required with IE, // this prevents the previous image displaying for a short burst causing flicker. if (navigator.appVersion.indexOf("MSIE")!=-1){ pause(250); } if (objLoadingImage) { objLoadingImage.style.display = 'none'; } objLightbox.style.display = 'block'; // After image is loaded, update the overlay height as the new image might have // increased the overall page height. arrayPageSize = getPageSize(); objOverlay.style.height = (arrayPageSize[1] + 'px'); // Check for 'x' keypress listenKey(); return false; } imgPreload.src = objLink.href; } // // hideLightbox() // function hideLightbox() { // get objects objOverlay = document.getElementById('overlay'); objLightbox = document.getElementById('lightbox'); // hide lightbox and overlay objOverlay.style.display = 'none'; objLightbox.style.display = 'none'; // disable keypress listener document.onkeypress = ''; } // // initLightbox() // Function runs on window load, going through link tags looking for rel="lightbox". // These links receive onclick events that enable the lightbox display for their targets. // The function also inserts html markup at the top of the page which will be used as a // container for the overlay pattern and the inline image. // function initLightbox() { if (!document.getElementsByTagName){ return; } var anchors = document.getElementsByTagName("a"); // loop through all anchor tags for (var i=0; i<anchors.length; i++){ var anchor = anchors[i]; if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "lightbox")){ anchor.onclick = function () {showLightbox(this); return false;} } } // the rest of this code inserts html at the top of the page that looks like this: // // <div id="overlay"> // <a href="#" onclick="hideLightbox(); return false;"><img id="loadingImage"></a> // </div> // <div id="lightbox"> // <a href="#" onclick="hideLightbox(); return false;" title="Click anywhere to close image"> // <img id="closeButton"> // <img id="lightboxImage"> // </a> // <div id="lightboxDetails"> // </div> // </div> var objBody = document.getElementsByTagName("body").item(0); // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file) var objOverlay = document.createElement("div"); objOverlay.setAttribute('id','overlay'); objOverlay.onclick = function () {hideLightbox(); return false;} objOverlay.style.display = 'none'; objOverlay.style.position = 'absolute'; objOverlay.style.top = '0'; objOverlay.style.left = '0'; objOverlay.style.zIndex = '90'; objOverlay.style.width = '100%'; objBody.insertBefore(objOverlay, objBody.firstChild); var arrayPageSize = getPageSize(); var arrayPageScroll = getPageScroll(); // preload and create loader image var imgPreloader = new Image(); // if loader image found, create link to hide lightbox and create loadingimage imgPreloader.onload=function(){ var objLoadingImageLink = document.createElement("a"); objLoadingImageLink.setAttribute('href','#'); objLoadingImageLink.onclick = function () {hideLightbox(); return false;} objOverlay.appendChild(objLoadingImageLink); var objLoadingImage = document.createElement("img"); objLoadingImage.src = loadingImage; objLoadingImage.setAttribute('id','loadingImage'); objLoadingImage.style.position = 'absolute'; objLoadingImage.style.zIndex = '150'; objLoadingImageLink.appendChild(objLoadingImage); imgPreloader.onload=function(){}; // clear onLoad, as IE will flip out w/animated gifs return false; } imgPreloader.src = loadingImage; // create lightbox div, same note about styles as above var objLightbox = document.createElement("div"); objLightbox.setAttribute('id','lightbox'); objLightbox.style.display = 'none'; objLightbox.style.position = 'absolute'; objLightbox.style.zIndex = '100'; objBody.insertBefore(objLightbox, objOverlay.nextSibling); // create link var objLink = document.createElement("a"); objLink.setAttribute('href','#'); objLink.setAttribute('title','Click to close'); objLink.onclick = function () {hideLightbox(); return false;} objLightbox.appendChild(objLink); // preload and create close button image var imgPreloadCloseButton = new Image(); // if close button image found, imgPreloadCloseButton.onload=function(){ var objCloseButton = document.createElement("img"); objCloseButton.src = closeButton; objCloseButton.setAttribute('id','closeButton'); objCloseButton.style.position = 'absolute'; objCloseButton.style.zIndex = '200'; objLink.appendChild(objCloseButton); return false; } imgPreloadCloseButton.src = closeButton; // create image var objImage = document.createElement("img"); objImage.setAttribute('id','lightboxImage'); objLink.appendChild(objImage); // create details div, a container for the caption and keyboard message var objLightboxDetails = document.createElement("div"); objLightboxDetails.setAttribute('id','lightboxDetails'); objLightbox.appendChild(objLightboxDetails); // create caption var objCaption = document.createElement("div"); objCaption.setAttribute('id','lightboxCaption'); objCaption.style.display = 'none'; objLightboxDetails.appendChild(objCaption); } // // addLoadEvent() // Adds event to window.onload without overwriting currently assigned onload functions. // function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function'){ window.onload = func; } else { window.onload = function(){ oldonload(); func(); } } } addLoadEvent(initLightbox); // run initLightbox onLoad Any help is much appreciated xx 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! I've been working on a web-site and I've run into a problem. None of the buttons I've created will access the functions that they're supposed to access. When I used the JavaScript console in Chrome it threw the error Uncaught ReferenceError: (function) is not defined I've looked over it for syntax errors, but I couldn't find any. Am I missing anything? Here's my unfinished code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>N Physics</title> <script type="text/javascript"> var numforms = 0; var curentform = 0; //consider further editing function reset() { window.location.reload(); } function addvar() { currentform = numforms + 1; selectscreen(); } function changevar() { } function selectscreen() { selectdiv = document.createElement('div'); selectdiv.id = "select"; tkdklskjksdkfj variable = document.createElement('SELECT'); variable.setAttribute('Name', 'variable'); variable.id = "variable"; ForceReg = document.createElement('option'); ForceReg.value = '001'; ForceReg.appendChild(document.createTextNode('Force')); variable.appendChild(ForceReg); Mass = document.createElement('option'); Mass.value = '002'; Mass.appendChild(document.createTextNode('Mass')); variable.appendChild(Mass); Accelleration = document.createElement('option'); Accelleration.value = '003'; Accelleration.appendChild(document.createTextNode('Accelleration')); variable.appendChild(Accelleration); selectdiv.appendChild(variable); document.body.appendChild(selectdiv); } function newform() { } function cancel() { } function deleteform() { } fucntion checkprimary() { } function findeq() { } </script> <style type="text/css"> <!-- body { background-color:#999999; } #LayerHead { position:absolute; left:0px; top:0px; width:100%; height:50px; z-index:1; background-color: #000000; } .spacer { height:51px; z-index:0; } .Button { height:50px; z-index:2; } .style1 { color: #FFFFFF; font-size: 43px; z-index:1; } .style2 { color: #FFFFFF; font-size: 10px; z-index:3; } #LeftButton { width: 49%; height: 50px; left: 0px; z-index:2; } #RightButton { width: 49%; height: 50px; right: 0px; z-index:2; } #Bottom { position:fixed; background-color:#000000; width:100%; bottom: 0px; left: 0px; z-index:3; } #select { position: fixed; width: 100%; height: 100%; opacity: 0.7; filter: aplha(opacity=40); background-color:#333333; } #variable { position: fixed; top: 50%; width: 90%; margin-left: auto; margin-right: auto; } --> </style> </head> <body> <div id="LayerHead"> <span class="style1">N Physics</span> </div> <div class="spacer"></div> <div class="Button"> <input type="button" id="LeftButton" value="Instructions" onclick="location.href = 'instructions.html'" /> <input type="button" id="RightButton" value="Reset" onclick="reset();" /> </div> <div id="VarDone"></div> <div class="Button"> <input type="button" id="LeftButton" value="Add a New Variable" onclick="addvar();" /> <input type="button" id="RightButton" value="Find the Equation" onclick="findeq();" /> </div> <div id="Answer"></div> <div id="Bottom"> </div> </body> </html> On this website http://www.behance.net/Gallery/Designmonat-Graz/330277 there is an option at the bottom of every article to "appreciate" the article, if one chooses. The number of appreciations is listed under the project info. This is much like facebook.com's "like" feature. I would like this feature for articles in my own website. Just a button that when clicked, would change and say Thank you and then a visual total number of clicks on that button on the page. Help?? I am trying to figure out a way to have a page redirect if the mysql connection fails. The issue is that the page is already loaded and the only time this would be needed is if the user tries to perform operations on a loaded page after the session runs out. So basically, I have a page that will allow you to search for an item using ajax, then select an item and press add which will place the item in another table displaying detailed information. Both operations connect to the database using SESSION variables to save the connection information. My goal is to use the "or die()" method to print something that will force a redirect because this could happen in a number of places in the site and I want to try and get them all in one swipe. Here is what seemed like it would be the most promising: Code: $conn = mysql_connect($_SESSION['host'], $_SESSION['username'], $_SESSION['password']) or die("<script>location.href= '../login.php'</script>"); Unfortunately the javascript never runs.... I tried putting alerts also and nothing, but with firebug I can see they are printed. Any idea how I can ensure that the javascript is executed? Thanks in advance. What i'm trying to accomplish is two things. To select the page i want to load in each tab then select how many of thoughs tabs i wish to open. When the number of tabs is selected i want it to launch. i also have a refresh button that works i just can't get the windows to load. by the way for this project i want it to open the same url that is selected on all of the tabs. Here is what i have: <html> <head> </head> <form name="myform"> <select name="mySelectbox"> <option value="">Choose a destination...</option> <option value="http://www.yahoo.com/">YAHOO</option> <option value="http://www.google.com/">GOOGLE</option> <option value="http://www.altavista.com/">ALTAVISTA</option> <option value="http://www.amazon.com/">AMAZON</option> </select> </form> <form name = "myform2"> <select name = "numberWindows" onchange = "openThem()"> <option value = "0">Choose....</option> <option value = "1">TEST</option> <option value = "2">2</option> <option value = "3">3</option> <option value = "4">4</option> <option value = "5">5</option> </select> </form> <script> function open_win() { var myurl = parseInt(document.myform.myselectbox.value); window.open("myurl"); } </script> <script type = "text/javascript"> var i; function openThem() { var val = parseInt(document.myform2.numberWindows.value); for (i =0; i < val; i++) { open_win(); } } document.write('<form><input type=button value="Refresh To Do Again" onClick="history.go()"></form>') </script> </body> </html> Can someone please help. I'm just trying to learn how this is done. Thanks. |