JavaScript - Problems Adding Javascript To My Site
I am a first-time Javascript user and am trying to add the Magic Image Rotator code to my site: San Diego Solar.
I have followed others suggestions and directions from other places but I still can't figure it out. Here is the Javascript code I am trying to run: MagicImage.js Here is the code I am inserting into the HTML (via a .PHP file: a specific way that is used for Thesis theme on Wordpress which I run for my site). Code: function MagicImage() { ?> <html> <body> <script language="javascript" type="text/javascript" src="http://www.sandiegosolarenergy.org/wp-content/themes/thesis_18/lib/scripts/MagicImage.js"></script> </body> </html> <?php } add_action('thesis_hook_header','MagicImage'); Using Firebug for Firefox, I get errors showing up on line 37 of MagicImage.js... though I don't know what to do with that line of code. The problem is that nothing is showing up on the page! Can someone help me? Similar TutorialsI'm trying to add an internal site search to my website, and it only work for some search items, not for everything. For example, if I search for Bud Light, Budweiser, Bud Light Lime, it finds them. But if I search for Stella Artois, Paulaner, or Hoegaarden, it doesn't find anything. I'm thinking there's something wrong with the javascript code, I'm just not sure how to fix it. I really appreciate any help with this!!! Here's the code in the head region: [<script type="text/javascript"> // Google Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com) // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/ // This notice must stay intact for use //Enter domain of site to search. var domainroot="www.mhdbud.com" function Gsitesearch(curobj){ curobj.q.value="www.mhdbud.com:"+domainroot+" "+curobj.qfront.value } </script>] Here's what I've got in the body: [<form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)"> <input name="q" type="hidden" /> <input name="qfront" type="text" style="width: 180px" /> <input type="submit" value="Search" /> </form> You can try the site search to see what I'm talking about on this webpage: http://www.mhdbud.com/productsalt.html] My name is matt a very fed up up person at the min iam building a website my self for my print and design business, and it has come to the part where i need to list my products and buy now options etc. Well to be frank i dont have a clue how to do it so i dont have reams of pages of boxes etc. So could you help me (point me in the right direction i saw some of your tutorials and hope you can help here is the page with business cards on this one is ok because there is only 6 options to chose in sense of qty. but when it comes to LEAFLETS ITS HARD COS YOU HAVE DIFFERENT SIZE QTY PRICE. Iam using a cart software that links to google checkout for payment side If there is anything you can suggest i would be greatfull Sorry this is all over the place been up all night Matthew Cook Hey CF, I'm currently working on a website called 'eXtreme Gaming' I've almost completed it, apart from two things. - Adding two values on my checkout page for the Grandtotal (I've tried everything, but I'm too much of a noob and have probably missed something small). - Validation of forms (I don't know where to start here, I've looked on w3schools for tuts etc but I'm having difficulty incorporating it on my site) I'm going to put the code for my checkOut page only, if you are able to help me many thanks in advance. [quote] Code: <HTML> <HEAD> <script language="JavaScript" src="laptopsCookie.js"> </script> <script language="JavaScript" src="desktopsCookie.js"> </script> <script language="JavaScript"><!-- function calculateTotalPurchaseLaptop(formRef) { var laptopTotal=0; for (var i=0; i<LaptopListPurchase.length/2;i++) { var subTotal = formRef.elements['quantity'+i].value * formRef.elements['price'+i].value; formRef.elements['subTotal'+i].value = subTotal.toFixed(2); // document.orderForm2.grandTotal.value = document.orderForm.laptopTotal.value + document.orderForm2.desktopTotal.value laptopTotal += subTotal; } formRef.laptopTotal.value = laptopTotal.toFixed(2); } //--></script> <script language="JavaScript"><!-- function calculateTotalPurchaseDesktop(formRef) { var desktopTotal=0; for (var i=0; i<DesktopListPurchase.length/2;i++) { var subTotal = formRef.elements['quantity'+i].value * formRef.elements['price'+i].value; formRef.elements['subTotal'+i].value = subTotal.toFixed(2); desktopTotal += subTotal; } formRef.desktopTotal.value = desktopTotal.toFixed(2); } //--></script> <script language="Javascript"><!-- function checkform() { if (document.payment.Name.value == "") { alert('Please enter a name'); return false; } //else if(isNaN(document.payment.CreditCard.value) || document.payment.CreditCard.length !== 10) //{ // alert('Invalid Credit Card Number'); // return false; //} else if (document.payment.Adress.value == "") { alert('Please enter your adress.'); return false; } else if (document.payment.State.selectedIndex == 0) { alert('Please select a state'); return false; } return true; } </script> </HEAD> <BODY> <TITLE>Check Out</TITLE> <script> var html = ""; html += '<TABLE align="center"><tr><td><img src = "images/checkOutTitle.png" align="center" style="border:none" /></td></tr></TABLE>'; html += '<TABLE align = "center" border="2" cellpadding="2" cellspacing="2" width="80%">' html += '<form id = "orderForm" name = "orderForm" method = POST action="javascript:void(0)">'; html += '<tr>'; html += '<th>Product</th><th>Quantity</th><th>Price</th><th>Sub Total</th>'; html += '</tr>'; for (var i=0; i<LaptopListPurchase.length;i=i+2) { html += '<tr><td>' + LaptopListPurchase[i] + '</td>'; html += '<td><select NAME="quantity' + i/2 + '" onChange="calculateTotalPurchaseLaptop(this.form)">'; html += '<OPTION VALUE="0">0</OPTION><OPTION VALUE="1">1</OPTION><OPTION VALUE="2">2</OPTION>'; html += '<OPTION VALUE="3">3</OPTION><OPTION VALUE="4">4</OPTION><OPTION VALUE="5">5</OPTION>'; html += '</select></td>'; html += '<td>$<input type="text" name="price' + i/2 + '" size=5 value="' + LaptopListPurchase[i+1] + '" readonly></td>'; html += '<td>$<input type="text" name="subTotal' + i/2 + '" size=5 value="0.00" readonly></td>'; html += '</tr>'; } html += '<tr>'; html += '<td></td>'; html += '<td></td>'; html += '<td></td>'; html += '<td>$<input type=TEXT name="laptopTotal" value="" readonly size=7></td></tr>'; html += '</form>'; html += '</table>'; document.write(html); // Update the quantities // var quantityLaptop; for (var i=0; i<LaptopList.length/2;i++) { // Get the quantity of each type of Laptop // quantityLaptop = getCookie("Laptop" + i); document.orderForm.elements("quantity"+i).value = quantityLaptop; } // Update the totals // calculateTotalPurchaseLaptop(document.orderForm) var html = ""; html += '<TABLE align = "center" border="2" cellpadding="2" cellspacing="2" width="80%">' html += '<form id = "orderForm2" name = "orderForm2" method = POST action="javascript:void(0)">'; html += '<tr>'; html += '<th>Product</th><th>Quantity</th><th>Price</th><th>Sub Total</th>'; html += '</tr>'; for (var i=0; i<DesktopListPurchase.length;i=i+2) { html += '<tr><td>' + DesktopListPurchase[i] + '</td>'; html += '<td><select NAME="quantity' + i/2 + '" onChange="calculateTotalPurchaseDesktop(this.form)">'; html += '<OPTION VALUE="0">0</OPTION><OPTION VALUE="1">1</OPTION><OPTION VALUE="2">2</OPTION>'; html += '<OPTION VALUE="3">3</OPTION><OPTION VALUE="4">4</OPTION><OPTION VALUE="5">5</OPTION>'; html += '</select></td>'; html += '<td>$<input type="text" name="price' + i/2 + '" size=5 value="' + DesktopListPurchase[i+1] + '" readonly></td>'; html += '<td>$<input type="text" name="subTotal' + i/2 + '" size=5 value="0.00" readonly></td>'; html += '</tr>'; } html += '<tr>'; html += '<td></td>'; html += '<td></td>'; html += '<td></td>'; html += '<td>$<input type=TEXT name="desktopTotal" value="0.00" readonly size=7></td></tr>'; html += '<td></td>'; html += '<td></td>'; html += '<td align = "center"><b>Grand Total</b></td>'; html += '<td>$<input type=TEXT name="grandTotal" value="0.00" readonly size=7></td></tr>'; html += '</form>'; html += '</table>'; document.write(html); // Update the quantities // var quantityDesktop; for (var i=0; i<DesktopList.length/2;i++) { // Get the quantity of each type of Desktop // quantityDesktop = getCookie("Desktop" + i); document.orderForm2.elements("quantity"+i).value = quantityDesktop; } // Update the totals // calculateTotalPurchaseDesktop(document.orderForm2) </script> <table align = 'center'> <tr> <td><h1>Pay for your Purchase Below</h1></td> </tr> </table> <table border="1" align = 'center' > <form name="payment" method="post"> <tr> <td> Name on Credit Card: <input type="text" name="Name" /><br /> Credit Card number: <input type="text" name="CreditCard" /><br /> Street Adress: <input type="text" name="Adress" /><br /> Town: <input type="text" name="Town" /><br /> State/Territory: <select NAME="State"><OPTION VALUE="Null">--</OPTION><OPTION VALUE="Australian Capital Territory">ACT</OPTION><OPTION VALUE="South Australia">SA</OPTION><OPTION VALUE="Northen Territory">NT</OPTION><OPTION VALUE="Queensland">QLD</OPTION><OPTION VALUE="Victoria">Vic</OPTION><OPTION VALUE="Western Australia">WA</OPTION><OPTION VALUE="Tasmania">Tas</OPTION></select> </td> <td> <INPUT TYPE="RADIO" NAME="Master Card" VALUE="Master Card">Master Card<BR> <INPUT TYPE="RADIO" NAME="Visa" VALUE="Visa">Visa<BR> <INPUT TYPE="RADIO" NAME="AMEX" VALUE="American Express">American Express<BR> </td> </tr> <tr> <td></td> <td><input type="submit" value="Submit" onclick="return checkform()"></td> </tr> </table> </BODY> </HTML>[ /quote] I have a script which opens an HTML page and passes the current URL to a form on the page. I'm also using RokBox, which open a window as an overlay on the current page rather than as a popup. It is triggered by adding rel="rokbox" to any link. For instance, the following link opens moreinfo.htm using RokBox: Code: <a rel="rokbox" href="/modules/mod_S5tellafriend/moreinfo.htm">More Info</a> Problem is the link doesn't pass the URL. The following code passes the URL but doesn't trigger RokBox: Code: <input type="button" class="button" value="MORE INFORMATION" onclick="s5_open_taf_popup()"/> <script type="text/javascript"> var s5_taf_parent = window.location; function s5_open_taf_popup() { window.open('/modules/mod_S5tellafriend/moreinfo.htm','page','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=420,height=570,left=50,top=50,titlebar=yes') } </script> Is there a way to add rel="rokbox" to the script? Or maybe pass the URL with the link instead? Thanks! How can I build a table that prompts user for number of rows and then number of columns and then builds it based on user input?
I have a simple problem. I want to add the current page's url to a link, like this: <code> <a href="http://www.somesite.com/somepage.aspx?a="> </code> After the 'a=' I need to add javascript that will return the current url. It can be the full url (example: http://www.codingforums.com/newthrea...=newthread&f=2) or a partial one (example: /newthread.php?do=newthread&f=2). Can someone help me with an example? I am trying to set up a web that new times will be displayed when they add current times to a form. here is the static HTML <form method="POST" > current time is 11:32 AM</p> <p>add <input type="text" name="T1" size="5" value="20"> mins and the new time time would be <b> 11:52 AM</b></p> <p>add another<input type="text" name="T2" size="5" value="15"> mins and the time then changes to <b>12:07 PM</b></p> <p><input type="submit" value="Submit" name="B1"></p> <p><input type="reset" value="Reset" name="B2"></p> </form> I would like to have the new times to change dynamically as they type in either (or both) input boxes I have found a code to help me learn how to add forms in javascript, but it's limited to text input forms. Code: <script type="text/javascript"><!-- function updatesum() { document.form.sum.value = (document.form.sum1.value -0) + (document.form.sum2.value -0); } //--></script> Where the inputs sum1 and sum2 are text fields you put whatever numbers you want in. That works fine. Great. Now what I'm having trouble with is modifying the code so that it will add one form with an input number with a form that spits out a randomly generated number. Code: <input type="button" value="D20" onclick="this.form.display.value = Math.round (20 * Math.random())" class="buttonHi" /> <input name="display" type="text" size="6" value="" /> This is what I'm using for my random number generator. So basically I want to be able to put, say, 5, into the input text field above this. And then click on the d20 button to get a random number, say, 15, and then have the first code add the inputted 5 with the randomly generated 15. Is this possible? hi, Guys can u help me currently iam running clicksor ads on my blog but its decrease page load time and page stuck where javascrip is located can u help me . how can i put this javascript in iframe so that this javascript loads but never stuck the page thanx Regards Fawad I am trying to use the javascript tabifier found here. I have it successfully working with the 3 tabs that the example comes with. I have not been able to figure out how to add more tabs to this. I would like to have quite a few more tabs. Any help or guidance is very much appreciated. Thanks, RK My code goes through the answer function (below) and it determins if you answered green. If you answered green a popup says correct other wise incorrect. How can I modify my code so that I can add multiple answers for different questions.Example q1 answer = green q2 answer = blue . . q20 answer = Friday Here is my .js code Code: var n = 16; // modify this for number of seconds to answer document.getElementById( 'time').value = "Answer in " + n + " seconds"; var i = setInterval('count()' , 1000); var tooLate; function count() { tooLate = 0; n--; if(n >=0) { document.getElementById( 'time').value = "Answer in " + n + " seconds"; } else { clearInterval(i); alert("Too late!"); if(document.getElementById( 'answer').value == correct){ tooLate = 1; } } function answer() { var correct = "green"; // This is the correct answer if (tooLate == 0) { if(document.getElementById( 'answer').value == correct) { clearInterval(i); alert("Right Answer with " + n + " seconds remaining"); } else{ clearInterval(i); alert("Incorrect! The answer was " + correct); } } submitform(); //submit form function submitform() { document.forms["myform"].submit(); } } Hello all! I am using 'simplecartjs' as a simple shopping cart for my website. To checkout, the user e-mails me his cart containts. I would like to have his name, email and adress with this but i'm unable to add this to my shopping form. Here is my JS: Code: me.emailCheckout = function() { itemsString = ""; for( var current in me.items ){ var item = me.items[current]; itemsString += item.name + " " + item.quantity + " " + item.price + "\n"; } var form = document.createElement("form"); simpleCart.empty(); form.style.display = "none"; form.method = "POST"; form.action = "sendjs.php"; form.acceptCharset = "utf-8"; form.appendChild(me.createHiddenElement("jcitems", itemsString)); form.appendChild(me.createHiddenElement("jctotal", me.total)); document.body.appendChild(form); form.submit(); document.body.removeChild(form); } And here is the PHP that sends is (sendjs.php): Code: <?php $to = 'info@kheuning.nl'; $subject = 'the subject'; $jcitems = $_POST['jcitems']; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $jcitems, $headers); Header('Location: thankyou.html'); ?> I understand how to add variables to send in my php form, but it doesn't take normale html form input's i add to the page. How can i add these to the js? Thanks in advance! Jonas Hey all, I'm sure this is very basic but I'm having a hard time adding a hyperlink to text within javascript. I want to add a website link to the text 'click here' that is being displayed under the image within javascipt. I end up modifying the whole image instead, removing the javascript that displays the larger version of the image. Can anyone help me out please? Here's the coding. I'm using Dreamweaver CS5 on a PC to modify a few things and using another website building program to get the basic layout. I'm just a small business owner trying to get my website off the ground. Thanks in advance! <div id="imCel1_01"> <div id="imCel1_01_Cont"> <div id="imObj1_01"> <a href="javascript:imShowBox('files/june2011.jpg',500,500,'Right click to print....................Click HERE for website!','IMG','t');" title=""><img src="images/p025_1_01.jpg" alt="" title="" /></a> </div> Hi, I have this design, where the menu is a JavaScript that makes the content page flow in from the right. As a standard there are only 4 menu objects, but I need a fifth one. I have tried to add another myself, and change everything i thought important in the javascript.js, but it just doesn't work. The javascript screws up, so I am clearly missing something. Therefore i'm hoping that someone inhere, can help me adding it. Below are the index, javascript and stylesheet included. If I'm not making myself clear, please let me know and I will try to explain it better Thanks walkie index.htm Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Identity</title> <script type="text/javascript" src="javascript/jquery.js"></script> <script type="text/javascript" src="fancybox/jquery.fancybox.js"></script> <script type="text/javascript" src="javascript/javascript.js"></script> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" href="fancybox/jquery.fancybox.css" type="text/css" media="screen" /> </head> <body> <div id="leftSide"> <!--Site Title--> <div id="title"> <!--Main Title--> <h1><span></span>Identity</h1> <!--Caption/Sub Title--> <span class="titleSubText">the portfolio of john smith</span> </div> <div id="arrowWrapper"><div id="arrow"></div></div> <div id="buttonsWrapper"> <!--About Button--> <div id="aboutButtonWrapper"> <div class="navButton" id="aboutButton"></div> <div class="navCaption" id="aboutCaption"> <!--About Button: Label--> <span class="navCaptionText">about</span><br /> <!--About Button: Sub-Label--> <span class="navSubCaptionText">who I am</span> </div> </div> <!--Portfolio Button--> <div id="portfolioButtonWrapper"> <div class="navButton" id="portfolioButton"></div> <div class="navCaption" id="portfolioCaption"> <!--Portfolio Button: Label--> <span class="navCaptionText">portfolio</span><br /> <!--Portfolio Button: Sub-Label--> <span class="navSubCaptionText">my work</span> </div> </div> <!--Services Button--> <div id="servicesButtonWrapper"> <div class="navButton" id="servicesButton"></div> <div class="navCaption" id="servicesCaption"> <!--Services Button: Label--> <span class="navCaptionText">services</span><br /> <!--Services Button: Sub-Label--> <span class="navSubCaptionText">what I do</span> </div> </div> <!--Contact Button--> <div id="contactButtonWrapper"> <div class="navButton" id="contactButton"></div> <div class="navCaption" id="contactCaption"> <!--Contact Button: Label--> <span class="navCaptionText">contact</span><br /> <!--Contact Button: Sub-Label--> <span class="navSubCaptionText">get in touch</span> </div> </div> </div> </div> <div id="contentPanelWrapper"> <div id="contentPanelEdge"></div> <!--Wrapper That Contains 'About' Content--> <div class="content" id="aboutContent"> <!--Title--> <div class="contentTitle">about</div> <!--Body Text--> <div id="aboutText"> <h3>Who I Am</h3><br /> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius, nisi non pretium elementum, dolor leo sagittis nunc, at pharetra ligula urna ut ligula. Morbi ac erat ante, in feugiat libero. Quisque nec mauris neque. Quisque sit amet condimentum turpis. Sed at arcu eu augue venenatis viverra. Vivamus odio nulla, facilisis et commodo at, sagittis id neque.</p><br /> <p>Nulla facilisi. Quisque non tellus justo, at tempor nisl. Fusce eleifend augue euismod sem varius pulvinar. Etiam rutrum magna in quam ultrices sit amet dictum nulla commodo.</p> </div> </div> <!--Wrapper That Contains 'Portfolio' Content--> <div class="content" id="portfolioContent"> <!--Title--> <div class="contentTitle">portfolio</div> <!--Image Slider--> <div id="portfolioSlider"> <div id="sliderToolbar"> <div class="sliderButton" id="prevButton"></div> <div class="sliderButton" id="nextButton"></div> </div> <div id="imageWrapper"> <ul id="imgList"> <!--Portfolio Images Go Here (See Documentation)--> <li><a class="sliderImage" href="images/portfolio/img1-large.jpg"><img alt="" src="images/portfolio/img1-small.jpg" /></a></li> <li><a class="sliderImage" href="images/portfolio/img2-large.jpg"><img alt="" src="images/portfolio/img2-small.jpg" /></a></li> <li><a class="sliderImage" href="images/portfolio/img3-large.jpg"><img alt="" src="images/portfolio/img3-small.jpg" /></a></li> <li><a class="sliderImage" href="images/portfolio/img4-large.jpg"><img alt="" src="images/portfolio/img4-small.jpg" /></a></li> </ul> </div> </div> </div> <!--Wrapper That Contains 'Services' Content--> <div class="content" id="servicesContent"> <!--Title--> <div class="contentTitle">services</div> <!--Service 1 Column--> <div class="serviceColumn" id="serviceColumn1"> <h3>Identity Design</h3><br /> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius, nisi non pretium elementum, dolor leo sagittis nunc, at pharetra ligula urna ut ligula.</p> </div> <!--Service 2 Column--> <div class="serviceColumn" id="serviceColumn2"> <h3>Web Design</h3><br /> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius, nisi non pretium elementum, dolor leo sagittis nunc, at pharetra ligula urna ut ligula.</p> </div> <!--Service 3 Column--> <div class="serviceColumn" id="serviceColumn3"> <h3>Icon + UI Design</h3><br /> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius, nisi non pretium elementum, dolor leo sagittis nunc, at pharetra ligula urna ut ligula.</p> </div> </div> <!--Wrapper That Contains 'Contact' Content--> <div class="content" id="contactContent"> <!--Title--> <div class="contentTitle">contact</div> <div id="contactFormWrapper"> <!--Contact Form--> <form id="contact" method="post" action="mail.php"> <input type="text" id="name" name="name" value="name" /> <input type="text" id="email" name="email" value="email" /><br /><br /> <textarea id="message" name="message" rows="" cols="">message</textarea> <input type="image" id="submit" src="images/sendButtonDis.png" disabled="disabled" /> </form> <div id="successMessage"></div> </div> </div> </div> </body> </html> javascript.js Code: numImages=0; currentImage=1; currentPanel="none"; $(document).ready(function(){ // Initializes FancyBox Lightbox $("a.sliderImage").fancybox({ 'zoomSpeedIn':200, 'zoomSpeedOut':200, 'overlayShow':true, 'padding':4 }); SelectButton("none"); $("#arrow").fadeOut(0); if (navigator.appVersion.indexOf("MSIE 7.0")!=-1){ $("input").css({"height":13}); $("#name").css({"width":155}); }; $("#title").click(function(){ ShowPanel("none"); }); // Handles Formatting the Portfolio Slider $("#imgList").children().each(function(){ numImages++; }); $("#imageWrapper").css({"width":(numImages*541)}); // Handles Function of the Portfolio Slider $("#prevButton").click(function(){ if (currentImage==1){ currentImage=numImages; } else { currentImage--; }; $("#imageWrapper").animate({"left":-((currentImage-1)*541)},500); }); $("#nextButton").click(function(){ if (currentImage==numImages){ currentImage=1; } else { currentImage++; }; $("#imageWrapper").animate({"left":-((currentImage-1)*541)},500); }); // Handles Rollover and Click For the Nav Buttons $("#aboutButton").mouseenter(function(){ SelectButton("about"); }); $("#portfolioButton").mouseenter(function(){ SelectButton("portfolio"); }); $("#servicesButton").mouseenter(function(){ SelectButton("services"); }); $("#contactButton").mouseenter(function(){ SelectButton("contact"); }); $("#aboutButton,#portfolioButton,#servicesButton,#contactButton").mouseleave(function(){ SelectButton("none"); }); $("#aboutButton").click(function(){ ShowPanel("about"); }); $("#portfolioButton").click(function(){ ShowPanel("portfolio"); }); $("#servicesButton").click(function(){ ShowPanel("services"); }); $("#contactButton").click(function(){ ShowPanel("contact"); }); // Handles Contact Form Behavior $("#name").focus(function(){ $("#name").css({"background-color":"#FFFFFF"}); if ($("#name").val()=="name"){ $("#name").val(""); $("#name").css({"color":"#444444"}); }; }); $("#name").blur(function(){ if ($("#name").val()==""){ $("#name").val("name"); $("#name").css({"color":"#888888"}); $("#name").css({"background-color":"#ffdddd"}); }; }); $("#email").focus(function(){ $("#email").css({"background-color":"#FFFFFF"}); if ($("#email").val()=="email"){ $("#email").val(""); $("#email").css({"color":"#444444"}); }; }); $("#email").blur(function(){ if ($("#email").val()==""){ $("#email").val("email"); $("#email").css({"color":"#888888"}); $("#email").css({"background-color":"#ffdddd"}); }; if ($("#email").val().indexOf("@")==-1 || $("#email").val().indexOf(".")==-1){ $("#email").css({"background-color":"#ffdddd"}); }; }); $("#message").focus(function(){ $("#message").css({"background-color":"#FFFFFF"}); if ($("#message").val()=="message"){ $("#message").val(""); $("#message").css({"color":"#444444"}); }; }); $("#message").blur(function(){ if ($("#message").val()==""){ $("#message").val("message"); $("#message").css({"color":"#888888"}); $("#message").css({"background-color":"#ffdddd"}); }; }); $("#submit").mousedown(function(){ $("#submit").attr({"src":"images/sendButtonSel.png"}); }); $("#submit").mouseup(function(){ $("#submit").attr({"src":"images/sendButton.png"}); }); $("#submit").mouseout(function(){ $("#submit").attr({"src":"images/sendButton.png"}); }); $("#name,#email,#message").keyup(function(){ if ($("#name").val()!="" && $("#name").val()!="name" && $("#email").val()!="" && $("#email").val()!="email" && $("#email").val().indexOf("@")>-1 && $("#email").val().indexOf(".")>-1 && $("#message").val()!="" && $("#message").val()!="message"){ EnableSubmitButton(); } else { DisableSubmitButton(); }; }); $("#submit").click(function(){ DisableSubmitButton(); var dataString="name=" + $("#name").val() + "&email=" + $("#email").val() + "&message=" + $("#message").val(); $.ajax({ type: "POST", url: "mail.php", data: dataString, success: function() { ResetForm(); $("#successMessage").fadeIn(10); setTimeout('$("#successMessage").fadeOut(1000);',2000); } }); return false; }); }); function EnableSubmitButton(){ $("#submit").attr({"disabled":""}); $("#submit").attr({"src":"images/sendButton.png"}); }; function DisableSubmitButton(){ $("#submit").attr({"disabled":"disabled"}); $("#submit").attr({"src":"images/sendButtonDis.png"}); }; function ResetForm(){ DisableSubmitButton(); $("#name, #email, #message").css({"background-color":"#FFFFFF"}); $("#name, #email, #message").css({"color":"#888888"}); $("#name").val("name"); $("#email").val("email"); $("#message").val("message"); }; function ShowPanel(panel){ currentPanel=panel; SelectButton(panel); $(".content").fadeOut(250); switch(panel){ case "none": $("#contentPanelWrapper").animate({"left":"100%"},500); $("#arrow").fadeOut(50) break; case "about": $("#contentPanelWrapper").animate({"left":"100%"},500,function(){ $("#aboutContent").show(); $("#contentPanelWrapper").animate({"left":"44%"},500); }); $("#arrow").animate({"top":22},150,function(){$("#arrow").fadeIn(50)}); break; case "portfolio": $("#contentPanelWrapper").animate({"left":"100%"},500,function(){ $("#portfolioContent").show(); $("#contentPanelWrapper").animate({"left":"44%"},500); }); $("#arrow").animate({"top":98},150,function(){$("#arrow").fadeIn(50)}); break; case "services": $("#contentPanelWrapper").animate({"left":"100%"},500,function(){ $("#servicesContent").show(); $("#contentPanelWrapper").animate({"left":"44%"},500); }); $("#arrow").animate({"top":170},150,function(){$("#arrow").fadeIn(50)}); break; case "contact": $("#contentPanelWrapper").animate({"left":"100%"},500,function(){ $("#contactContent").show(); $("#contentPanelWrapper").animate({"left":"44%"},500); }); $("#arrow").animate({"top":243},150,function(){$("#arrow").fadeIn(50)}); break; }; }; function SelectButton(button){ if (currentPanel!="about"){ $("#aboutCaption").animate({"left":50},{queue:false, duration:250}); $("#aboutCaption").animate({"opacity":0},{queue:false, duration:250}); $("#aboutButton").css({"background-position":"0px 0px"}); }; if (currentPanel!="portfolio"){ $("#portfolioCaption").animate({"left":50},{queue:false, duration:250}); $("#portfolioCaption").animate({"opacity":0},{queue:false, duration:250}); $("#portfolioButton").css({"background-position":"0px -64px"}); }; if (currentPanel!="services"){ $("#servicesCaption").animate({"left":50},{queue:false, duration:250}); $("#servicesCaption").animate({"opacity":0},{queue:false, duration:250}); $("#servicesButton").css({"background-position":"0px -128px"}); }; if (currentPanel!="contact"){ $("#contactCaption").animate({"left":50},{queue:false, duration:250}); $("#contactCaption").animate({"opacity":0},{queue:false, duration:250}); $("#contactButton").css({"background-position":"0px -192px"}); }; switch(button){ case "none": break; case "about": $("#aboutCaption").animate({"left":70},{queue:false, duration:250}); $("#aboutCaption").animate({"opacity":1},{queue:false, duration:250}); $("#aboutButton").css({"background-position":"65px 0px"}); break; case "portfolio": $("#portfolioCaption").animate({"left":70},{queue:false, duration:250}); $("#portfolioCaption").animate({"opacity":1},{queue:false, duration:250}); $("#portfolioButton").css({"background-position":"65px -64px"}); break; case "services": $("#servicesCaption").animate({"left":70},{queue:false, duration:250}); $("#servicesCaption").animate({"opacity":1},{queue:false, duration:250}); $("#servicesButton").css({"background-position":"65px -128px"}); break; case "contact": $("#contactCaption").animate({"left":70},{queue:false, duration:250}); $("#contactCaption").animate({"opacity":1},{queue:false, duration:250}); $("#contactButton").css({"background-position":"65px -192px"}); break; }; }; Hi, im fairly new at all this, so please forgive me if I have misunderstood the guidelines on posting threads for this topic. Im needing some help with adding a timed delay for a widget I have on my website. My website is hosted on moonfruit, a flash based web builder, its very beginners level, and so this makes me feel like the new kid at school posting on this forum. however moonfruit does have a HTML/JavaScript snippet Which allows me to paste in code and show the cooliris gallery But is has become crucial to my websites completion that this widget must have a timed delay on it ive been at google for days till the point where im seeing the same pages again, and have come across setTimeout, unfortunately that's as far as I can seem to go, ive tried pasting in the code in numerous places and I just cant get it to work, i have pasted in other JavaScript codes, and they have worked, so i am convinced that its just me being a noob, other than it being a limitation on moonfruit I would appreciate any help with this Here is the code that im trying to get a delayed time of 10 seconds or so. [CODE] <object id="o" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="845" height="350"><param name="movie" value="http://apps.cooliris.com/embed/cooliris.swf"/><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always"/><param name="flashvars" value="style=dark&backgroundColor=#0d0d0d&feed=api://www.flickr.com/?user=41683862@N04%26album=72157622009594203&glowColor=#FFFFFF&showSearch=false&showEmbed=false&show Tutorial=true&showChrome=true"/><embed type="application/x-shockwave-flash" src="http://apps.cooliris.com/embed/cooliris.swf" flashvars="style=dark&backgroundColor=#0d0d0d&feed=api://www.flickr.com/?user=41683862@N04%26album=72157622009594203&glowColor=#FFFFFF&showSearch=false&showEmbed=false&show Tutorial=true&showChrome=true" width="845" height="350" allowFullScreen="true" allowScriptAccess="always"></embed></object> [CODE] Again any help is most appreciated PHP Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> <!-- var image1=new Image() image1.src="images/slideshow/image001.jpg" var image2=new Image() image2.src="images/slideshow/image002.jpg" var image3=new Image() image3.src="images/slideshow/image003.jpg" var image4=new Image() image4.src="images/slideshow/image004.jpg" var image5=new Image() image5.src="images/slideshow/image005.jpg" var image6=new Image() image6.src="images/slideshow/image006.jpg" var image7=new Image() image7.src="images/slideshow/image007.jpg" var image8=new Image() image8.src="images/slideshow/image008.jpg" var image9=new Image() image9.src="images/slideshow/image009.jpg" var image10=new Image() image10.src="images/slideshow/image010.jpg" var image11=new Image() image11.src="images/slideshow/image011.jpg" var image12=new Image() image12.src="images/slideshow/image012.jpg" var image13=new Image() image13.src="images/slideshow/image013.jpg" var image14=new Image() image14.src="images/slideshow/image014.jpg" var image15=new Image() image15.src="images/slideshow/image015.jpg" var image16=new Image() image16.src="images/slideshow/image016.jpg" var image17=new Image() image17.src="images/slideshow/image017.jpg" var image18=new Image() image18.src="images/slideshow/image018.jpg" var image19=new Image() image19.src="images/slideshow/image019.jpg" var image20=new Image() image20.src="images/slideshow/image020.jpg" //--> </script> </head> <body> <img src="images/slideshow/image001.jpg" name="slide"> <script type="text/javascript"> <!-- //variable that will increment through the images var step=1 function slideit(){ //if browser does not support the image object, exit. if (!document.images) return document.images.slide.src=eval("image"+step+".src" ) if (step<20) step++ else step=1 //call function "slideit()" every 2.5 seconds setTimeout("slideit()",2500) } slideit() //--> </script> </body> </html> Good morning! Hopefully somebody can help me with this javascript question. (No knowledge of Google Anayltics needed for this.) I'm adding Google Analytics 'Event Tracking' javascript to a typical 'Add to Cart' button. The customer enters desired quantity in the text box and clicks the 'Add to Cart' button to order. I would like to use the Event Tracking javascript to record the button click - plus the Value entered in the text box - as one event. Here's the code for the form (the text box and 'Add to Cart' button code lines are bold): Code: <form method="post" action="http://www.yoursite.com/mm5/merchant.mvc?"> <input type="hidden" name="Screen" value="BASK" /> <input type="hidden" name="Product_Code" value="yourproductcode" /> <input type="hidden" name="Action" value="ADPR" /> <label for="quantity">Quantity:</label> <input type="text" name="quantity" value="0" /> <input type="submit" value="Add To Cart" /> </form> I came up with this javascript for the Event Tracking (to be inserted somewhere above): Code: onClick="_gaq.push(['_trackEvent', 'OrderForms', 'AddToCart', 'yourproductcode', document.getElementByName('quantity').value]);" I'm wondering where I would enter this javacript code inside the form code to pick up both the button click - plus the quantity? You'll notice that I'm using 'getElementByName' to extract 'quantity' from the text box and record its 'value'. If I enter this javascript on the 'Add to Cart' line - right after "Add to Cart", would 'quantity' still get picked up upon button-click - since it's all on the same form? Or would it be a problem because 'quantity' is contained in a different <input> container? Thanks! Any help is greatly appreciated. IB Hi everyone, I have successfully added Flash to my page but I want the flash animation to be inside the <div id="main">. For some reason when I put the <div id="flashcontent"></div> inside the main div it doesn't show up on the page. Please help. My code is below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MikeJamesDesigns</title> <link rel="stylesheet" type="text/css" href="cssEdit.css" /> <script type="text/javascript" src="js/flashobject.js"></script> <script type="text/javascript"> var fo = new FlashObject("bannerISRAEL.swf", "animationName", "450", "60", "8", "#FFFFFF"); fo.addParam("allowScriptAccess", "sameDomain"); fo.addParam("quality", "high"); fo.addParam("scale", "noscale"); fo.addParam("loop", "true"); fo.write("flashcontent"); </script> </head> <body> <!--<div class="tikiImage"> <img src="/Users/MikeJamesRossi/Desktop/cssEdit/images/tiki.png" alt="tikiTorch" height="1040px" width="1100px"/> </div>--> <div id="wrapper"> <div id="sitebranding"> </div><!--end of sitebranding div--> <div id="navigation"> <a href="home">Home</a> | <a href="about">About</a> | <a href="news">News</a> | <a href="images">Images</a> | <a href="home">Faq</a> | <a href="contact">Contact</a> </div><!--end of navigation div--> <div id="main"> <div id="flashcontent"></div> </div><!--end of main div--> </div><!--end of wrapper div--> </body> </html> My css file looks like this: #flashcontent { position: relative; top: 500px; left: 365px; width: 60px; heightx; background-color:red; z-index: ; } Any help would be greatly aprreciated!! Thanks Mike! Hi Im taking a course in web design and am working on a basic javascript page. I have a drop down box where you select a item and it opens a new window. How would I get the back ground color to be the same as the web page color (lightblue), what code would I use and where in my code would I put it? [CODE] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>MEG</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- var content; var oneWindow; var fullWindow; var oneWindowStatus = false; var fullWindowStatus = false; function closeAllWindows() { if((oneWindowStatus) && (!oneWindow.closed)) oneWindow.close(); if((fullWindowStatus) && (!fullWindow.closed)) fullWindow.close(); oneWindowStatus = false; fullWindowStatus = false; } function productObject(name,description,use,image) { this.name = name; this.description = description; this.use = use; this.image = image; this.displayOne = displayOne; } //Add products here var products = new Array(); products[0] = new productObject("Ears", "Fluffy, pointy, big", "For hearing other dogs near by, for listening to my owner but ignoring her", "images/ears.jpg"); products[1] = new productObject("Eyes", "Shiny, brown, pretty", "To see dogs to bark at, to see when treats are available", "images/eyes.jpg"); products[2] = new productObject("Nose", "Black, wet", "For sniffing out food and squirrels", "images/nose.jpg"); products[3] = new productObject("Mouth", "BIG", "For barking loudly with", "images/mouth.jpg"); products[4] = new productObject("Tongue", "Pink, wet", "To lick you with when you really dont want her to", "images/tongue.jpg"); products[5] = new productObject("Legs", "Short, fluffy", "To run as fast as possible with after squirrels", "images/legs.jpg"); products[6] = new productObject("Paws", "Small", "To raise when I want treats/food of any sort", "images/paws.jpg"); var len = products.length; function displayOne() { content=""; content+="<HTML><HEAD><TITLE>" + this.name + "</TITLE></HEAD>"; content+="<BODY><DIV ALIGN='center'>"; content+="<TABLE WIDTH='90%'><TR><TD COLSPAN='3' ALIGN='center'>"; content+="<H3>Name: " + this.name.bold() + "</H3><HR>"; content+="<TR><TD><B>Name:</B> " + this.name; content+="<TR><TD><B>Description:</B> " + this.description; content+="<TR><TD><B>Use:</B> " + this.use; content+="<TR><TD><IMG SRC= '" + this.image + "' HEIGHT='100' WIDTH='100'>"; content+="</TABLE><FORM>"; content+="<INPUT TYPE='button' VALUE='OK' onClick='window.close();'>"; content+="</FORM></DIV></BODY></HTML>"; oneWindow = open("","OneWindow","width=500,height=400"); newWindow(oneWindow); oneWindowStatus = true; } function showAll() { content=""; content+="<HTML><HEAD><TITLE>All that is Meg</TITLE></HEAD>"; content+="<BODY><DIV ALIGN=center>"; content+="<TABLE WIDTH='90%' BORDER CELLPADDING='2'>"; content+="<TR><TH COLSPAN='2' ALIGN='center'>"; content+="All that is Meg"; content+="<TR><TH>Name<TH>Image"; for (var i = 0; i < len; i++) { content+="<TR><TD>"; content+="<A HREF='javascript:void(window.opener.products[" + i + "].displayOne());'>"; content+=products[i].name + "</A>"; content+="<TD>" + products[i].description; } content+="</TABLE><FORM>"; content+="<INPUT TYPE='button' VALUE='OK' onClick='window.close();'>"; content+="</FORM></DIV></BODY></HTML>"; fullWindow = open("","AllWindow","width=500,height=400,resizable=1"); newWindow(fullWindow); fullWindowStatus = true; } function newWindow(x) { x.document.close(); x.document.open(); x.document.write(content); x.document.close(); x.moveTo(20,20); x.focus(); } //--> </SCRIPT> </SELECT> </HEAD> <BODY onFocus="closeAllwindows();" bgcolor="lightblue"> <DIV ALIGN="center"> <H2>Meg</H2> <HR> <FORM NAME="prodForm"> <TABLE WIDTH="100%"> <TR> <TD WIDTH="50%" ALIGN="right"> <SELECT NAME="itemName"> <SCRIPT LANGUAGE="JavaScript"> <!-- for (var i = 0; i < len; i++) { document.write("<OPTION>" + products[i].name); } //--> </SCRIPT> </SELECT> <TD> <INPUT TYPE="button" VALUE="Get Info" onClick=" var i = document.prodForm.itemName.selectedIndex; products[i].displayOne();"> <TR><TD ALIGN="right"> <TR><TD colspan="2" ALIGN="center"> <TR><TD colspan="2" ALIGN="center"> <INPUT TYPE="button" VALUE="Show All Products" onClick="showAll();"> </TABLE> </FORM> <img src="images/meg1.jpg" "alt="Meg" border="2"/> </DIV> </BODY> </HTML> [CODE] Thanks and hope someone can help Claire |