JavaScript - Problem Feeding Php Into Framework
Hello, I'm hoping someone can help me with this.
I have 3 pages that I need to put into my framework, they are products, shopping cart and billing. At the moment they work perfectly fine. Here is a live example - http://www.cems.uwe.ac.uk/~r4-george...g/products.php Now, I have a framework for a whole website that I need to put these pages into. (http://www.cems.uwe.ac.uk/~r4-george/wp4/index.php) The index uses a switch statement to go between pages. Here is the index.php PHP Code: <?php # index.php /* * This is the main page. * This page includes the configuration file, * the templates, and any content-specific modules. */ // Require the configuration file before any PHP code: require_once ('./modules/config.inc.php'); // Validate what page to show: if (isset($_GET['p'])) { $p = $_GET['p']; } elseif (isset($_POST['p'])) { // Forms $p = $_POST['p']; } else { $p = NULL; } // Determine what page to display: switch ($p) { case 'about': $page = 'about.inc.php'; $page_title = 'About This Site Again'; break; case 'products': $page = 'products.inc.php'; $page_title = 'Products on this site'; break; case 'this': $page = 'this.inc.php'; $page_title = 'This is Another Page.'; break; case 'that': $page = 'that.inc.php'; $page_title = 'That is Also a Page.'; break; case 'contact': $page = 'contact.inc.php'; $page_title = 'Contact Us'; break; case 'search': $page = 'search.inc.php'; $page_title = 'Search Results'; break; // Default is to include the main page. default: $page = 'main.inc.php'; $page_title = 'Site Home Page'; break; } // End of main switch. // Make sure the file exists: if (!file_exists('./modules/' . $page)) { $page = 'main.inc.php'; $page_title = 'Site Home Page'; } // Include the header file: include_once ('./includes/header.inc'); echo "<div id=\"content\">"; // Include the content-specific module: // $page is determined from the above switch. include ('./modules/' . $page); // Include the footer file to complete the template: include_once ('./includes/footer.inc'); ?> It uses the .inc.php files located in the modules folder to switch between pages. Here is my products.inc.php - PHP Code: <?php # index.php /* * This is the main page. * This page includes the configuration file, * the templates, and any content-specific modules. */ // Require the configuration file before any PHP code: require_once ('./modules/config.inc.php'); // Validate what page to show: if (isset($_GET['p'])) { $p = $_GET['p']; } elseif (isset($_POST['p'])) { // Forms $p = $_POST['p']; } else { $p = NULL; } // Determine what page to display: switch ($p) { case 'about': $page = 'about.inc.php'; $page_title = 'About This Site Again'; break; case 'products': $page = 'products.inc.php'; $page_title = 'Products on this site'; break; case 'this': $page = 'this.inc.php'; $page_title = 'This is Another Page.'; break; case 'that': $page = 'that.inc.php'; $page_title = 'That is Also a Page.'; break; case 'contact': $page = 'contact.inc.php'; $page_title = 'Contact Us'; break; case 'search': $page = 'search.inc.php'; $page_title = 'Search Results'; break; // Default is to include the main page. default: $page = 'main.inc.php'; $page_title = 'Site Home Page'; break; } // End of main switch. // Make sure the file exists: if (!file_exists('./modules/' . $page)) { $page = 'main.inc.php'; $page_title = 'Site Home Page'; } // Include the header file: include_once ('./includes/header.inc'); echo "<div id=\"content\">"; // Include the content-specific module: // $page is determined from the above switch. include ('./modules/' . $page); // Include the footer file to complete the template: include_once ('./includes/footer.inc'); ?> This is EXACTLY the same code as the working example. The products get listed correctly but the problem I have is the 'Add to Cart' button fails to work. Live example - http://www.cems.uwe.ac.uk/~r4-george...php?p=products Everything is in the right directory. When I inspect the 'Add to Cart' button in chrome I get the following - Quote: Uncaught TypeError: Cannot set property 'value' of undefined addtocartindex.php:51 (anonymous function)index.php:83 onclick Any help is really appreciated, I'm struggling to see what I have done wrong. I don't know whether it's a Javascript problem. If you need any of the code from other pages I can post it too. Thanks in advance. Similar TutorialsThere are other similar topics, but this one is different. I am making an external js file and I want to use prototype.js with it. I don't want it in the html file that is referencing the .js file, I actually want to use prototype in the .js file. I'd just rather not copy the 4,000 lines of prototype if there is an easier way to do it. Sorry if I'm not being clear, but thanks for the help in advance. Jazzo Hi All, I am working on dot net framework 1.1.4322. From my html code of aspx file i have called a javascript function like 'onlick =javascript:saveorder()'. I have two copies of same code(identical - compared wit file compare tool) on different machine. When i run my code on one of the machine i get an error ';' expected which is a Javascript error and same time i wont get this error on another machine. When i searched on line number provided from error i saw few auto generated script which i have not putted there. Can anyone help me with the error at least with the reason. Thanks Mishigun Hey All, Recently, I finished making the first version of my own JavaScript framework. Basically, I like Prototype and jQuery so I made one that has what I personally like the best about both of them. Regardless, I'm hoping someone can guide me in the right direction to finding a nice JavaScript documentation creator. Or something that can at least parse my code and get me a decent start on creating the docs. I would also love to easily stylize the pages too. Thanks everyone! Rick Hello all, I want to present my designed and still in development state javascript framework with AMD architecture and many ideas. For first imageination please visit this page: http://arto8.site11.com/arto8-js/bindings.htm Day by day wold changes and new ideas implementation, Regularly visit to see new inovations. I have set if sentence when form is validate like: {if $smarty.request.action == "form1"} {nocache} {literal} <script type="text/javascript"> document.location='replyfile'; </script> {/literal} {/nocache} {/if} 1. How to retrieve values with Smarty as fields have value in name='' ...'' as now it does not capture value in form. 2. How to send form ONLY when all fields are validated? I have currently: {if $smarty.request.action == "form1"} and send button like: <input type="submit" name="form" value="Send my messages" class="mybutton" /> How to send after validation is performed? 3. This should mean sending form when name="form1" is clicked. Is it if sentence correct set with name form1? Application is: http://bassistance.de/jquery-plugins...in-validation/ Version 1.7. Now is sending when I click on button but it should send values and after validation is made. Hello JavaScripters! I was hoping you could help me with an application I'm working on using C# and the .NET Framework that incorporates Javascript. I'm trying to do something similar to to the FireBug / Firefox Inspect Element featu I came across http://www.selectorgadget.com/ which is exactly what I'm trying to do. It's in Javascript and after looking through the source code for the past 2 hours I still don't have a clue how to incorporate it into my program... From what I can tell it uses tokenizing and recursive analysis of DOM elements to figure out CSS selector paths: http://www.selectorgadget.com/stable/lib/dom.js. Here is what I have so far. The javascript code highlights HTML elements such as a <table> tag and changes the border and background color. Code: document.onmouseover = dohighlight; document.onmouseout = dohighlightoff; var BGCOLOR = "#444444"; var BORDERCOLOR = "#FF0000"; // Highlight <table> in grey function dohighlight() { var elem = window.event.srcElement; while (elem!=null && elem.tagName!="TABLE") elem = elem.parentElement; if (elem==null) return; if (elem.border==0) { elem.border = 1; // store current values in custom tag attributes // elem.oldcolor = elem.style.backgroundColor; // store backgroundcolor elem.style.backgroundColor = BGCOLOR; // new background color elem.oldbordercolor = elem.style.borderColor; // same with bordercolor elem.style.borderColor = BORDERCOLOR; var rng = document.body.createTextRange(); rng.moveToElementText(elem); // Make a red border around <table> function dohighlightoff() { var elem = window.event.srcElement; while (elem!=null && elem.tagName!="TABLE") elem = elem.parentElement; if (elem==null) return; if (elem.border==1) { elem.border = 0; // recover values from custom tag attribute values elem.style.backgroundColor = elem.oldcolor; elem.style.borderColor = elem.oldbordercolor; } } Any ideas on how to incorporate the Selectorgadget into my program would be greatly appreciated! Selectorgadget Source Code: https://github.com/iterationlabs/selectorgadget Hi pals, I am really tired in this problem of event keyup. I given same in my keyup function like: $(document).ready(function () { alert("GGG"+parseInt(jQuery.browser.version)); //To display test value working $("#find_text").keyup(function(e) { if(e.which == 13) { alert('Enter key was pressed'); //enter Here alert("FFF"+parseInt(jQuery.browser.version)); //Here got Error } }); }); I got Error : jQuery is not defined alert("FFF"+parseInt(jQuery.browser.version)); I use keycode,which , but no help, It's Work nicely in Chrome Browser but not in FF. Please give a Solution reply ASAP, I am really Tired.The code enter the Condition But that jQuery part make error. Thankfully Anes P.A Hi, so I thought I could mash two bits of code together like this: Code: <div><label for="or">From:</label> <select name="or" style="width:200px; float: right" id="or" onchange="populate(this)"> <option value="Choose">Select your starting point</option> <option value="Guatemala">Guatemala City</option> <option value="Xela">Quetzaltenango</option> <option value="Antigua">Antigua</option> <option value="Rio Dulce">Rio Dulce</option> <option value="Coban">Coban</option> </select></div> <div> <label for="de">To:</label> <select name="de" style="width:200px; float: right" id="de"></select> </div> <div> <br> <input type="button" onclick="searchLocations()" value="Show route" /> </div> </div> </div> </div> <script type="text/javascript"> if (GBrowserIsCompatible()) { var gpolylines = []; function populate(o) { d=document.getElementById('de'); if(!d){return;} var mitems=new Array(); mitems['Choose']=['']; mitems['Guatemala']=['Select Destination','Antigua','El Rancho junction','San Pedro La Laguna','Panajachel','Coban','Rio Hondo','Chiquimula','Esquipulas','Copan Ruinas (Honduras)','La Ruidosa junction','Rio Dulce','Flores (via Rio Dulce)','Puerto Barrios','Flores (via Coban)','Quetzaltenango']; mitems['Xela']=['Select Destination','Guatemala City','Antigua','Chichicastenango','Huehuetenango','Panajachel','San Pedro La Laguna']; mitems['Antigua']=['Select Destination','Guatemala City','Quetzaltenango','Escuintla','Monterrico','San Pedro la Laguna','Panajachel','Chichicastenango']; mitems['Rio Dulce']=['Select Destination','Guatemala City','Flores','Lanquin','Coban','Puerto Barrios']; mitems['Coban']=['Select Destination','Lanquin','Rio Dulce','Laguna Lachua NP','Flores']; d.options.length=0; cur=mitems[o.options[o.selectedIndex].value]; if(!cur){return;} d.options.length=cur.length; for(var i=0;i<cur.length;i++) { d.options[i].text=cur[i]; d.options[i].value=cur[i]; } } function searchLocations() { var found = false; var from = document.getElementById('or').value; var to = document.getElementById('de').value; for (var a = 0; a < gpolylines.length; a++) { if (gpolylines[a].myname.toLowerCase() == to.toLowerCase() && gpolylines[a].mycategory.toLowerCase() == from.toLowerCase()) { found = true; gpolylines[a].show(); } } if ( ! found ) alert("No matches found. Please check your spelling or refine your search."); } the first bit, which populates the select boxes works fine, as you can see here but the second bit (the searchLocations function) is giving me a bit more trouble. What it's supposed to be doing is saying that if there's a polyline whose category xml attribute matches the text from the 1st select box AND whose name attribute matches the 2nd select box, it should be shown. The methods have worked in the past, there are no errors reported - the only problem is I get the alert regardless of which option I am selecting. I suspect that the problem is in the if (gpolylines[a].myname.toLowerCase() == to.toLowerCase() && gpolylines[a].mycategory.toLowerCase() == from.toLowerCase()) line, as it's the only one that I really came up with on my own... or can I not get the "or" and "de" elements in that way? Or is it something else entirely? thanks in advance for any suggestions... For help I m putting it all together ..copy and paste and run ... I used 2 browsers IE and mozilla... you fill find the problem ...I know some one will definatly solve my problem ..... Code: <script type="text/javascript" language="JavaScript"><!-- function ManageTabPanelDisplay() { var idlist = new Array('tab1focus','tab2focus','tab3focus','tab4focus','tab1ready','tab2ready','tab3ready','tab4ready','content1','content2','content3','content4'); if(arguments.length < 1) { return; } for(var i = 0; i < idlist.length; i++) { var block = false; for(var ii = 0; ii < arguments.length; ii++) { if(idlist[i] == arguments[ii]) { block = true; break; } } if(block) { document.getElementById(idlist[i]).style.display = "block"; } else { document.getElementById(idlist[i]).style.display = "none"; } } } //--></script> <style type="text/css"> .tab { font-family: verdana,sans-serif; font-size: 12px; width: 100px; height:30px; white-space: nowrap; text-align: center; border-style: solid; border-color: #9a9a9a; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 0px; padding-top: 5px; padding-bottom: 5px; padding-left:3px; padding-right:3px; cursor: pointer; } .tabhold { background-color:#9a9a9a; /*color of menu #666666*/ color: white; } .tabfocus { background-color:white; color: #666666; } .tabcontent { font-family: sans-serif; font-size: 12px; height: 320px; border-style: solid; border-color: #9a9a9a; border-width: 1px; padding-top: 15px; padding-left: 10px; padding-right: 10px; overflow-y:scroll;overflow:-moz-scrollbars-vertical; } </style> <table border="0" cellpadding="0" cellspacing="0" > <tr > <td> <div id="tab1focus" class="tab tabfocus" style="display:block; padding-top:10px; height:39px;" > Overview </div> <div id="tab1ready" class="tab tabhold" style="display:none; padding-top:10px;height:39px;"> <span onclick="ManageTabPanelDisplay('tab1focus','tab2ready','tab3ready','tab4ready','content1')" >Overview </span> </div> </td><td > </td><td> <div id="tab2focus" class="tab tabfocus" style="display:none;"> Dimensions <br /> & Details </div> <div id="tab2ready" class="tab tabhold" style="display:block;"> <span onclick="ManageTabPanelDisplay('tab1ready','tab2focus','tab3ready','tab4ready','content2')">Dimensions <br /> & Details</span> </div> </td><td > </td><td> <div id="tab3focus" class="tab tabfocus" style="display:none;"> Quantity <br /> & Constructions </div> <div id="tab3ready" class="tab tabhold" style="display:block;"> <span onclick="ManageTabPanelDisplay('tab1ready','tab2ready','tab3focus','tab4ready','content3')">Quantity <br /> & Constructions</span> </div> </td> <td > </td><td> <div id="tab4focus" class="tab tabfocus" style="display:none;"> Customization <br /> Options </div> <div id="tab4ready" class="tab tabhold" style="display:block;"> <span onclick="ManageTabPanelDisplay('tab1ready','tab2ready','tab3ready','tab4focus','content4')">Customization <br /> Options </span> </div> </td> <td width="100%"> </td><td> </tr> <tr > <td colspan="8" > <div id="content1" class="tabcontent" style="display:block;"> content1 </div> <div id="content2" class="tabcontent" style="display:none;"> content2 </div> <div id="content3" class="tabcontent" style="display:none;"> content3 </div> <div id="content4" class="tabcontent" style="display:none;"> content4 </div> </td></tr> </table> please help thanks Code: <html> <head> <!-- CIS 340 Final Webpage project Author: Jeffrey Faulkner Date: 04/27/2011 File name: Mailinglist.htm --> <title>Home</title> <link href="mario.css" rel="stylesheet" type="text/css" /> <script src="random.js" type="text/javascript"></script> <script src="ads.js" type="text/javascript"></script> <script type="text/javascript"> function valmail() { var lastName = document.Infoform.LastName.value; var firstname = document.Infoform.FirstName.value; var mi = document.Infoform.Mi.value; var address = document.Infoform.Address.value; var city = document.Infoform.City.value; var state = document.Infoform.State.value; var zip = document.Infoform.Zip.value; var phone = document.Infoform.Phone.value; var dob = new Date (document.Infoform.Dob.value); var res = document.Infoform.chkResident.value; var email = document.infoform.email.value; var cemail = document.infoform.cemail.value; var stuClass; var classChecked = false; var selectnews = document.getElementById('lstF_ID'); var advisor = selectnews.options (selectnews.selectedIndex).innerHTML var radio = document.Infoform.Class.value; for (var i=0; i < document.Infoform.Class.length; i++) { if (document.Infoform.Class[i].checked) { classChecked = true; stuClass = document.Infoform.Class[i].value; } } if (lastName == "") { alert ("Please enter a last name"); document.Infoform.LastName.select(); return false; } else if (firstname == "") { alert ("Please enter a first name"); document.Infoform.FirstName.select(); return false; }else if (address == "") { alert ("Please enter a address"); document.Infoform.Address.select(); return false; } else if (city == "") { alert ("Please enter a city"); document.Infoform.City.select(); return false; } else if (state == "") { alert ("Please enter a state"); document.Infoform.State.select(); return false; } else if (zip == "") { alert ("Please enter a zip"); document.Infoform.Zip.select(); return false; } else if (phone == "") { alert ("Please enter a phone"); document.Infoform.Phone.select(); return false; }else if (dob == "NaN") { alert ("Date of Birth is not valid, use MM/DD/YYYY to enter data"); document.Infoform.Dob.select(); return false; }else if (Class.checked == "false"){ alert ("No class selected"); return false; }else if (email != cemail){ alert ("emails are not the same."); return false; }else { alert ("Last name: " + lastName + "\n" + "First Name: " + firstname + "\n" + "mi: " + mi + "\n" + "Address: " + address + "\n" + "City: " + city + "\n" + "State: " + state + "\n" + "Zip: " + zip + "\n" + "phone: " + phone + "\n" + "Date of Birth: " + dob + "\n" + "Advisor " + advisor + "\n" + "classfication " + stuClass); return true; } } </script> </head> <body> <h5><script type="text/javascript"> rNumber = randInt(5); //generate a random integer from 1 to 5 rAd = adDescription(rNumber); // description of the random ad rLink = adLink(rNumber); // url of the random ad document.write("<a href=" + rLink + ">"); document.write("<img src='ad" + rNumber + ".jpg' alt='" + rAd + "' />"); document.write("</a>"); </script></h5> <hr /> <a href="Home.htm">Home</a> <a href="speedrun.htm">Speed Runs</a> <a href="History.htm">History</a> <a href="mailinglist.htm">Mailing List</a> <a href="games.xml">List of games</a> <hr /> <h5><h3>Mario Mailing List</h3></h5> <h5><h3><form name="Infoform" action="action%20marker" id="Infoform" onSubmit="valmail()"> <table align="center"> <tr> <td> Last Name:</td> <td><input type="text" name="LastName" size="20" /></td> <td></td> <td></td> <td><h4>Class:</h4></td> <td></td> </tr> <tr> <td> First Name:</td> <td><input type="text" name="FirstName" size="20" /></td> <td></td> <td><input type="radio" name="Class" value="Mail" /></td> <td>Mail<td> </tr> <tr> <td> MI:</td> <td><input type="text" name="Mi" size="5" /></td> <td></td> <td><input type="radio" name="Class" value="email" /></td> <td>Email</td> </tr> <tr> <td> Address:</td> <td><input type="text" name="Address" size="20" /></td> <td></td> <td><input type="radio" name="Class" value="email" /></td> <td>phone</td> </tr> <tr> <td> City:</td> <td><input type="text" name="City" size="20" /></td> <td></td> <td><input type="radio" name="Class" value="text" /></td> <td>text</td> </tr> <tr> <td> State:</td> <td><input type="text" name="State" size="5" /></td> <td></td> <td><input type="radio" name="Class" value="any" /></td> <td>any</td> </tr> <tr> <td> ZIP Code:</td> <td><input type="text" name="Zip" size="20" /></td> <td></td> <td></td> <td></td> </tr> <tr> <td> Phone:</td> <td><input type="text" name="Phone" size="20" /></td> <td></td> <td><input name="chkResident" type="checkbox" /></td> <td> All the above</td> </tr> <tr> <td> Date of Birth:</td> <td><input type="text" name="Dob" size="20" /></td> <td></td> <td>What news do you want to here about?</td> <td><select size="1" name="lstF_ID"> <option selected="selected" value="1">New speed runs</option> <option value="2">upcoming games</option> <option value="3">New bugs found</option> <option value="4">new speed runs</option> <option value="5">All</option> </select value="1"></td> </tr> <tr> <td> EMail:</td> <td><input type="text" name="email" size="20" /></td> <td></td> <td></td> <td></td> </tr> <tr> <td> confirm email:</td> <td><input type="text" name="cemail" size="20" /></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td><input type="submit" value="Submit" /></td> </tr> </table> </form></h3></h5> </body> <hr /> <address> All information taken from mario wiki </address> </html> I have looked at this for an hour and i can not find anything wrong I'm working with this form which has js calendar. unfortunately, I can't get the calendar to work onclick. It produces the following error: Code: Uncaught SyntaxError: Unexpected token can't make out the error. Not sure if this is related to another onclick function. Here is the actual code: Code: <form name='PaymentForm' onsubmit='return ValidatePaymentForm();' action='updatebalancedue.php' method='post'> <input type=\"hidden\" name=\"edit_sel_id\" value=\"$sel_id\"> <div id=\'pmt_header\'><center><table class=\'tablestyle2\' width=90% cellpadding=2 cellspacing=0> <tr valign='top'> <td style=\'border:1px solid #cccccc;\' width=\"28%\" align=\"justify\"> <table class=\'tablestyle_inner\' width=\"170\"> <tr> </td> </tr> <tr><td bgcolor='#000000'><font color='#FFFFFF' class='label'>Payment Received Date:</td> </tr> </table> <input type='text' value='$date' readonly name='theDate' size='11'><input type='button' class='NonPrintable' value='Calendar' onclick='displayCalendar(this.form.theDate,'yyyy/mm/dd',this)'> </td> <td style='border:1px solid #cccccc;' width=\"35%\"> <table class='tablestyle_inner' width='607'> <tr><td valign='top'class='label' width='110'>Date of Invoice</td> <td width='196'><span id='_PayType_sel'><input name='$date_on_invoice' value='$date_on_invoice' disabled='true' style='float: left' valign='top'></td> <td valign='top' width='106'>Client ID: </td><td valign='top'> <input name='$clientID' value='$clientID' disabled='true' style='float: left'></span></td> <tr><td class='label' width='110'>First Name:</td><td width='196'><input type='text' size='22' maxlength='50' value='$firstname' disabled='true' style='float: left'></td><td valign='top'>Last Name:</td><td valign='top'><input type='text' size='22' maxlength='50' value='$lastname' disabled='true' name='T1' style='float: left'></td> </tr> </table> </td> <td style='border:1px solid #cccccc;' width='35%' align='right'> <table class='tablestyle_inner'> <tr><td bgcolor='#000000'><font color='#FFFFFF' class='label' align='left'>New Bal.:</td></tr><tr><td><input name='dollarsymbol3' size='1' readonly style='border:0px;' value='$'><input id='amount' name='newbalance' readonly style='color: #EE0000' size='8' maxlength='16' value='0.00'> <!--<input type='text' name='newbalance' disabled='true' size='16' maxlength=\"18\" value='$0.00'--></td> </tr> </table> <td style='border:1px solid #cccccc;' width='35%' align='right'> <table class='tablestyle_inner'> <tr><td bgcolor='#000000'><font color='#FFFFFF' class='label' align=\"left\">Payment Reference:</td></tr><tr><td><input type='text' name='paymentref' size='16' maxlength='18' value='$RNO'</td> </tr> </table> </table></center> <br></div> <div id='items_table'><center> <table class='tablestyle' colspan=7 width='89%' cellpadding=2 cellspacing=0> <tr> <td style='border:1px solid #cccccc;' width=' 15%' class='tableheader' bgcolor='#000000'><font color='#FFFFFF'> Invoice Number</td> <td align='center' style='border: 1px solid #cccccc;' width=' 15%' class='tableheader' bgcolor='#000000'><font color='#FFFFFF'>Service Description</td> <td style='border: 1px solid #cccccc;' width=' 15%' class='tableheader' bgcolor='#000000'><font color='#FFFFFF'>Balance Due</td> <td style='border: 1px solid #cccccc;' width=' 15%' class='tableheader' bgcolor='#000000'><font color='#FFFFFF'>Payment</td> <td style='border: 1px solid #cccccc;' width=' 15%' style='border:1px solid #cccccc;' width=' 15%'class='tableheader' bgcolor='#000000'><font color='#FFFFFF'>Payment Type</td> </tr> <tr> <td valign='top' style='border-left: 0px solid #cccccc;' width=' 15%'><input type='text' name='$invoicenum' disabled='true' size='12' maxlength='10' value='$invoicenum' class='combo3' rel='code_id' title=''> </td><td valign='top' style='border-right: 0px solid #cccccc;' width=' 15%' ><span id='_code_id_sel'> <!-- the line below serves to auto adjust the textarea box in accordance with the box's content. The class allows the box to expend to 1000 this works with two files jquery.textarea-expander.js and jquery-1.3.2.min.js --> <textarea name='mytextarea' id='mytextarea' rows='3' cols='60' disabled='true'class='expand10-100'>$servicedesc</textarea> <!--<textarea name='servicedesc' cols='30' rows='2' disabled='true' >$servicedesc</textarea></span>--> </td> <input type=\"hidden\" name=\"dimension2_id\" value=\"0\"> <td valign='top' style='border-left: 0px solid #cccccc;' width=' 15%' align='left'> <input name='dollarsymbol2' size='1' readonly style='border:0px;' value='$'><input id='amount' name='balance' size='12' disabled='true' value='$new_bal' onChange='updatesum()'> <!--<input class='amount' type=\"text\" name='balance' disabled='true' size=\"15\" maxlength=\"15\" dec=\"2\" value='$Balancedue'>--></td> <td valign='top' style='border-left: 0px solid #cccccc;' width=' 15%' align='left'> <input name='dollarsymbol1' size='1' readonly style='border:0px;' value='$'><input id='amount' name='paymentamount' size='12' style='color: #71C671' value='0.00' onChange='updatesum()'></td> <td valign='top' style='border-left: 0px solid #cccccc;' width=' 15%' ><span<select autocomplete='on' name='paymenttype' ><OPTION>Select One <OPTION>Cash <OPTION>Check <OPTION>Visa <OPTION>Master Card <OPTION>AMEX <OPTION>Discover <OPTION>Other </select></span></td> </tr> </table></center> </div> <br><table align='center'><tr><td >Memo</td><td><textarea STYLE='display:inline' name='memo' cols='50' rows='3'></textarea></td> </tr> </table> <br><br><center><input type='button' class='NonPrintable' value='Select Another Record' ONCLICK='history.go(-1)'> <input type='submit' name='submit' class='NonPrintable' value='Record Payment'> <input type='button' class='NonPrintable' onClick='window.print()' value='Print' /> </center> </p> </form>"; I'm using the form within a php code. This is my script section: Code: <script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="../../js/jquery.textarea-expander.js"></script> <script> function ValidatePaymentForm() { var paymentamount = document.PaymentForm.paymentamount; var paymenttype = document.PaymentForm.paymenttype; if (paymentamount.value == "0.00") { window.alert("Sorry, no Payment Amount is indicated!"); paymentamount.focus(); return false; } if (paymenttype.value == "Select One") { window.alert("Indicate form of payment!"); paymenttype.focus(); return false; } return true; } </script> <!--script for calendar begins--> <link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK> <SCRIPT type="text/javascript" src="dhtmlgoodies_calendar.js?random=20060118"></script> <!--script for calendar ends--> The calendar code is highlighted in red. any assistance is appreciated! This is a program that calculates discriminant/number of solutions for a given quadratic equation.. it all works, but the number of solution field is not filled, so i think i did something wrong on my if else statements for it.. help! Code: <html> <head> <title>Untitled</title> </head> <script type="text/javascript"> <!-- Begin function quad(form) { a = form.a.value b = form.b.value c = form.c.value form.Dis.value = (b * b) - (4 * a * c) If(form.Dis.value > 0) { form.NumSol.value = 2 } Else;(form.Dis.value = 0) { form.NumSol.value = 1 } Else { form.NumSol.value = 0 } } // End --> </script> <body><center> <form name="form1"> <input type="text" name="a" size=5> x^2 + <input type="text" name="b" size=5> x + <input type="text" name="c" size=5> <input type="button" value="Calculate" onClick="quad(this.form)"> Discriminant: <input type="text" name="Dis" size = 7 /> Number of Solutions: <input type="text" name="NumSol" size = 7 /> </form> </center> </body> </html> hi i found some javascript on the internet that seemed to do what I wanted to achieve but cannot get it to work when the mouse is over the image it should show a bigger image. I've used the internet explorer debugger and there seems to be problem in the code, but i dont understand javascript programming. Im a php man myself. all the script is enclosed in this page http://www.web-malta.com/testimage.html if you put the mouse over the photo you will see there is an error on the page. hope someonbe can help. cheers I am creating a page which redirects automatically depending on the date. What I've done so far is below, but how would I make it go switch to exceeded_year.htm on 25th March 2011 for example? I will also include other dates and later put this page in a header frame and controlling the frame below so its constantly open. <html> <script type="text/javascript"> <!-- var currentTime = new Date() var date = currentTime.getDate() var month = currentTime.getMonth() + 1 var year = currentTime.getFullYear() if (year > 2011 ) {window.location = "exceeded_year.htm"; } else window.location="#" //--> </script> </html> Hi, i can't get my new logo to work in IE, it's working fine in Chrome and FireFox, it must be a JavaScript problem. here it is: http://danishwebart.com/logo/logo.php And the JavaScrip: $(function() { var canvas = $("#c"); var canvasHeight; var canvasWidth; var ctx; var dt = 0.1; var pointCollection; function init() { updateCanvasDimensions(); var g = [new Point(27, 34, 0.0, 1, "#ed9d33"), new Point(26, 38, 0.0, 1, "#d44d61"), new Point(25, 41, 0.0, 1, "#4f7af2"), new Point(22, 44, 0.0, 1, "#ef9a1e"), new Point(18, 46, 0.0, 2, "#4976f3"), new Point(12, 44, 0.0, 2.5, "#269230"), new Point(7, 41, 0.0, 2, "#1f9e2c"), new Point(5, 37, 0.0, 1, "#36b641"), new Point(4, 33, 0.0, 1, "#2e5def"), new Point(4, 29, 0.0, 1, "#d53747"), new Point(5, 25, 0.0, 1, "#eb676f"), new Point(6, 22, 0.0, 1, "#f9b125"), new Point(8, 19, 0.0, 1, "#de3646"), new Point(11, 16, 0.0, 1, "#5f8af8"), new Point(13, 14, 0.0, 1, "#efa11e"), new Point(16, 12, 0.0, 1, "#2e55e2"), new Point(19, 10, 0.0, 1, "#4167e4"), new Point(23, 8, 0.0, 1.5, "#4869e3"), new Point(28, 6, 0.0, 2, "#10a11d"), new Point(33, 5, 0.0, 2, "#cf4055"), new Point(38, 5, 0.0, 2, "#cd4359"), new Point(44, 6, 0.0, 3, "#ca273c"), new Point(51, 8, 0.0, 3, "#2650e1"), new Point(57, 11, 0.0, 3, "#4a7bf9"), new Point(63, 16, 0.0, 3.5, "#f47875"), new Point(68, 23, 0.0, 4, "#f36764"), new Point(71, 31, 0.0, 3.5, "#1d4eeb"), new Point(72, 38, 0.0, 3, "#698bf1"), new Point(72, 44, 0.0, 2.5, "#fac652"), new Point(72, 49, 0.0, 2, "#ee5257"), new Point(71, 54, 0.0, 2, "#5681f5"), new Point(70, 59, 0.0, 2, "#f8c247"), new Point(68, 64, 0.0, 2, "#4577f6"), new Point(65, 68, 0.0, 2, "#f7b326"), new Point(62, 72, 0.0, 2, "#facb5e"), new Point(59, 75, 0.0, 2, "#e02e3d"), new Point(55, 77, 0.0, 2, "#f16d6f"), new Point(53, 78, 0.0, 2.5, "#507bf2"), new Point(47, 79, 0.0, 3, "#5683f7"), new Point(40, 77, 0.0, 3.5, "#3158e2"), new Point(33, 74, 0.0, 3.5, "#f0696c"), new Point(27, 73, 0.0, 2.5, "#3769f6"), new Point(22, 73, 0.0, 2, "#6084ef"), new Point(19, 76, 0.0, 1.5, "#2a5cf4"), new Point(17, 79, 0.0, 1, "#f4716e"), new Point(25, 70, 0.0, 2, "#f8c247"), new Point(29, 67, 0.0, 2, "#ec4147"), new Point(33, 64, 0.0, 2, "#4876f1"), new Point(36, 59, 0.0, 2.5, "#2552ea"), new Point(38, 53, 0.0, 3, "#4779f7"), new Point(38, 46, 0.0, 3.5, "#4b78f1"), new Point(38, 38, 0.0, 3.5, "#4b78f1"), new Point(37, 31, 0.0, 2.5, "#4b78f1"), new Point(38, 25, 0.0, 2, "#4b78f1"), new Point(40, 20, 0.0, 2, "#4b78f1"), new Point(42, 16, 0.0, 1.5, "#4b78f1"), new Point(45, 14, 0.0, 1, "#4b78f1"), new Point(48, 12, 0.0, 1, "#4b78f1"), new Point(59, 82, 0.0, 1, "#ed9d33"), new Point(62, 80, 0.0, 1.5, "#d44d61"), new Point(66, 77, 0.0, 2, "#4f7af2"), new Point(70, 73, 0.0, 2, "#4976f3"), new Point(73, 69, 0.0, 2, "#269230"), new Point(76, 65, 0.0, 2, "#1f9e2c"), new Point(79, 60, 0.0, 2, "#36b641"), new Point(80, 55, 0.0, 1.5, "#2e5def"), new Point(81, 65, 0.0, 2.5, "#eb676f"), new Point(83, 71, 0.0, 3, "#f9b125"), new Point(84, 77, 0.0, 2.5, "#de3646"), new Point(82, 82, 0.0, 2, "#de3646"), new Point(88, 74, 0.0, 1.5, "#efa11e"), new Point(90, 70, 0.0, 1.5, "#2e55e2"), new Point(92, 66, 0.0, 1.5, "#4869e3"), new Point(93, 62, 0.0, 1.5, "#4869e3"), new Point(95, 53, 0.0, 1, "#10a11d"), new Point(95, 57, 0.0, 2, "#cf4055"), new Point(97, 62, 0.0, 2.5, "#cd4359"), new Point(100, 68, 0.0, 3, "#ca273c"), new Point(102, 74, 0.0, 2.5, "#2650e1"), new Point(101, 80, 0.0, 2, "#4a7bf9"), new Point(105, 78, 0.0, 1, "#f36764"), new Point(107, 75, 0.0, 1, "#1d4eeb"), new Point(109, 72, 0.0, 1, "#698bf1"), new Point(110, 69, 0.0, 1, "#fac652"), new Point(111, 66, 0.0, 1, "#ee5257"), new Point(112, 63, 0.0, 1, "#5681f5"), new Point(112, 60, 0.0, 1.5, "#f8c247"), new Point(112, 56, 0.0, 1.5, "#4577f6"), new Point(110, 52, 0.0, 2, "#f7b326"), new Point(107, 48, 0.0, 2.5, "#facb5e"), new Point(102, 45, 0.0, 2.5, "#e02e3d"), new Point(97, 43, 0.0, 2, "#f16d6f"), new Point(110, 83, 0.0, 1, "#507bf2"), new Point(112, 80, 0.0, 1, "#5683f7"), new Point(114, 77, 0.0, 1.5, "#3158e2"), new Point(116, 73, 0.0, 1.5, "#f0696c"), new Point(118, 69, 0.0, 1.5, "#3769f6"), new Point(119, 65, 0.0, 1.5, "#6084ef"), new Point(119, 61, 0.0, 1.5, "#2a5cf4"), new Point(119, 57, 0.0, 1.5, "#f4716e"), new Point(118, 53, 0.0, 1.5, "#f8c247"), new Point(116, 50, 0.0, 1, "#ec4147"), new Point(120, 51, 0.0, 1, "#4876f1"), new Point(123, 53, 0.0, 1, "#2552ea"), new Point(126, 55, 0.0, 1, "#4779f7"), new Point(129, 58, 0.0, 1.5, "#4b78f1"), new Point(132, 61, 0.0, 1.5, "#4b78f1"), new Point(135, 65, 0.0, 1.5, "#4b78f1"), new Point(138, 69, 0.0, 1.5, "#4b78f1"), new Point(140, 73, 0.0, 2, "#4b78f1"), new Point(142, 78, 0.0, 2, "#4b78f1"), new Point(143, 83, 0.0, 2, "#4b78f1"), new Point(121, 70, 0.0, 1, "#4b78f1"), new Point(124, 71, 0.0, 1, "#4b78f1"), new Point(127, 71, 0.0, 1, "#4b78f1"), new Point(130, 71, 0.0, 1.5, "#4b78f1"), new Point(134, 70, 0.0, 1.5, "#4b78f1"), new Point(142, 68, 0.0, 1.5, "#4b78f1"), new Point(146, 68, 0.0, 1, "#4b78f1"), new Point(149, 69, 0.0, 1, "#4b78f1")]; gLength = g.length; for (var i = 0; i < gLength; i++) { g[i].curPos.x = (canvasWidth/2 - 0) + g[i].curPos.x; g[i].curPos.y = (canvasHeight/2 - 0) + g[i].curPos.y; g[i].originalPos.x = (canvasWidth/2 - 0) + g[i].originalPos.x; g[i].originalPos.y = (canvasHeight/2 - 0) + g[i].originalPos.y; }; pointCollection = new PointCollection(); pointCollection.points = g; initEventListeners(); timeout(); }; function initEventListeners() { $(window).bind('resize', updateCanvasDimensions).bind('mousemove', onMove); canvas.get(0).ontouchmove = function(e) { e.preventDefault(); onTouchMove(e); }; canvas.get(0).ontouchstart = function(e) { e.preventDefault(); }; }; function updateCanvasDimensions() { canvas.attr({height: $(window).height(), width: $(window).width()}); canvasWidth = canvas.width(); canvasHeight = canvas.height(); draw(); }; function onMove(e) { if (pointCollection) pointCollection.mousePos.set(e.pageX, e.pageY); }; function onTouchMove(e) { if (pointCollection) pointCollection.mousePos.set(e.targetTouches[0].pageX, e.targetTouches[0].pageY); }; function timeout() { draw(); update(); setTimeout(function() { timeout() }, 30); }; function draw() { var tmpCanvas = canvas.get(0); if (tmpCanvas.getContext == null) { return; }; ctx = tmpCanvas.getContext('2d'); ctx.clearRect(0, 0, canvasWidth, canvasHeight); if (pointCollection) pointCollection.draw(); }; function update() { if (pointCollection) pointCollection.update(); }; function Vector(x, y, z) { this.x = x; this.y = y; this.z = z; this.addX = function(x) { this.x += x; }; this.addY = function(y) { this.y += y; }; this.addZ = function(z) { this.z += z; }; this.set = function(x, y, z) { this.x = x; this.y = y; this.z = z; }; }; function PointCollection() { this.mousePos = new Vector(0, 0); this.points = new Array(); this.newPoint = function(x, y, z) { var point = new Point(x, y, z); this.points.push(point); return point; }; this.update = function() { var pointsLength = this.points.length; for (var i = 0; i < pointsLength; i++) { var point = this.points[i]; if (point == null) continue; var dx = this.mousePos.x - point.curPos.x; var dy = this.mousePos.y - point.curPos.y; var dd = (dx * dx) + (dy * dy); var d = Math.sqrt(dd); if (d < 80) { point.targetPos.x = (this.mousePos.x < point.curPos.x) ? point.curPos.x - dx : point.curPos.x - dx; point.targetPos.y = (this.mousePos.y < point.curPos.y) ? point.curPos.y - dy : point.curPos.y - dy; } else { point.targetPos.x = point.originalPos.x; point.targetPos.y = point.originalPos.y; }; point.update(); }; }; this.draw = function() { var pointsLength = this.points.length; for (var i = 0; i < pointsLength; i++) { var point = this.points[i]; if (point == null) continue; point.draw(); }; }; }; function Point(x, y, z, size, colour) { this.colour = colour; this.curPos = new Vector(x, y, z); this.friction = 0.8; this.originalPos = new Vector(x, y, z); this.radius = size; this.size = size; this.springStrength = 0.1; this.targetPos = new Vector(x, y, z); this.velocity = new Vector(0.0, 0.0, 0.0); this.update = function() { var dx = this.targetPos.x - this.curPos.x; var ax = dx * this.springStrength; this.velocity.x += ax; this.velocity.x *= this.friction; this.curPos.x += this.velocity.x; var dy = this.targetPos.y - this.curPos.y; var ay = dy * this.springStrength; this.velocity.y += ay; this.velocity.y *= this.friction; this.curPos.y += this.velocity.y; var dox = this.originalPos.x - this.curPos.x; var doy = this.originalPos.y - this.curPos.y; var dd = (dox * dox) + (doy * doy); var d = Math.sqrt(dd); this.targetPos.z = d/100 + 1; var dz = this.targetPos.z - this.curPos.z; var az = dz * this.springStrength; this.velocity.z += az; this.velocity.z *= this.friction; this.curPos.z += this.velocity.z; this.radius = this.size*this.curPos.z; if (this.radius < 1) this.radius = 1; }; this.draw = function() { ctx.fillStyle = this.colour; ctx.beginPath(); ctx.arc(this.curPos.x, this.curPos.y, this.radius, 0, Math.PI*2, true); ctx.fill(); }; }; init(); }); Scratch that, its started working... oh well haha this is coder javascript : textneu = textneu.replace(/haha/,"<img src='../images/21.gif'>"); Result: <img src='../images/21.gif'> why? i want result is : <img src='../images/21.gif'> I really don't even know if I'm posting this question in the right section. I am using javascript to make a drop-down menu for a website. I really don't have any experience with javascript. The problem I'm having is that when I go to the page, the drop down menu is already dropped down. If you then hover over it, it pulls up and then hover over it again and it drops back down. It works fine after the initial glitch. Didn't know if anyone had run into this problem or if I'm just being stupid, here is the code that I'm using. Thanks in advance for any help. <a href="/mainpage.html" onMouseOver="show()" onMouseOut="hide()" ><img src="pic.png" border="0" width="90" height="24"></a></br> <div id="div1"><a href="/notherpage.html" onMouseOver="show()" onMouseOut="hide()" ><img src="pic2.png"><br><a href="/notherpage2.html" onMouseOver="show()" onMouseOut="hide()" ><img src="pic3.png"><br><a href="/lastpage.html" onMouseOver="show()" onMouseOut="hide()" ><img src="pic4.png"></div> <script type="text/javascript"> function show(){ document.getElementById("div1").style.display="block"; } function hide(){ document.getElementById("div1").style.display="none"; } </script> |