JavaScript - Exit Pop Problem ...
I'm currently working on a site with an exit pop asking the visitor, "Are you sure you want to leave?"
The problem is that one of the links in the page is triggering the exit pop when it shouldn't be. Here's the code: Code: <a href="intended_next_page.html" class="style4" onClick="ShowExitPopup = false;">Click Here To Continue </a> I know this itself is HTML, but it's related to the exit pop, which is Javascript, so I thought this forum would be the appropriate one. Any idea why this isn't working? I have another link on the page that looks identical (goes to a different page, but that's it), and it's working, but this one isn't. I can't figure it out. Any help is greatly appreciated. Similar TutorialsI re-wrote this code to display an exit notice alert and open a new window after user confirms they wish to leave the website. However, something is wrong with my code below. The alert and cancel alert works fine, but my new window link does not appear. I was curious if i could get some help fixing this code from anyone in the JavaScript programming forum. See code: <script language='JavaScript'> function ExitNotice() { if(confirm("You are now leaving the web site. To leave our site for the link you selected, click OK. Or Click Cancel to remain. Thank you for visiting our site.")) { return true; } history.go(0); return false; } </script> Now for my button code that appears later inside my form which opens a sized window. <input id="btnView" class="MyButton" type="button" onclick="ExitNotice('http://www.google.com', null, 'left=40,top=100,height=550,width=780, status=no,toolbar=no,menubar=no,location=no, resizable=yes, scrollbars=yes')" name="btnView" value="View Web Site" /> Please test and advise what i'm missing... thanks in advance as i eagerly wait for a solution that fixes this issue. Friends, I am looking for a PHP or Java Script to integrete in a PHP CMS, that enables to Redirect to Another URL when the script sense that the visitor is going away from the page. (Hit back button, hit refresh button and so on....) It should be unblockable by browsers. May anyone suggest me one or share the codes. I will use it for personal purpose and not for comercial purpose at all. Thanks Hello, I'll be honest I dont know much about javascript so hopefully one of you lovely people can help. My issue is I would like to have this code validate my radio buttons on my form and also have an onscreen pop-up in the case that the user is exiting the page without filling out the form. I have had both of these peices of code working...but when I put both of them on the page the pop-up will override the validation script, and I don't wish to have the pop-up, pop-up when the user hits the submit button. Here are my pieces of code: Inside my head tag: Code: <script language="JavaScript"> function closeIt() { return "\n********************************************\nWAIT! WAIT! WAIT! WAIT! WAIT! WAIT!\n********************************************\n\nDon't leave just yet...\n\nDon't worry - We will never rent, sell or\nshare your contact information, with\nanyone else. We respect your privacy\nand hate spam too!\n\n"; } window.onbeforeunload = closeIt; </script> <script language="JavaScript"> function valbutton(thisform) { // place any other field validations that you require here // validate myradiobuttons myOption = -1; for (i=thisform.infusion_option_0.length-1; i > -1; i--) { if (thisform.infusion_option_0[i].checked) { myOption = i; i = -1; } } if (myOption == -1) { alert("You must select an event city date"); return false; } // place any other field validations that you require here thisform.submit(); // this line submits the form after validation } </script> And then for my form and submit code I have: Code: <form name="myform" action="https://mydomain.com/AddForms/processFormSecure.jsp" method='POST' onSubmit="return NoneWithCheck();"> <input id="Submit" name="Submit" type="submit" value="Submit" onClick="valbutton(myform);return false;" /></form> Any help would be appreciated, thanks. Hello, Our website is built in ASP.NET and uses a content management system. The CMS came with a wealth of JavaScript files and I decided to use one of these files for form validation. Although the file is over 2,300 lines, from what I can tell it is supposed to return true if the form is valid and false otherwise. The problem is that a function inside that file seems to get to a certain point, and somehow quit and return true no matter if the form is valid or not. I am calling this JS from an ASP.NET button control. When the button is clicked, a JS function ValidateForm(document.forms[0]) is called. My ValidateForm function calls another function inside the JS file (which calls another, and another...). No matter what, when that second function is called and executed, code execution stops at some point and the form submits (postbacks). I can see that the validation is working just before the postback, but it is not preventing the form from being submitted, and it also stops executing any code after it. Here is my code: ASP: Code: <asp:Button ID="SubmitBtn" runat="server" Text="Submit Form" CausesValidation="false" CssClass="submit_button" OnClientClick="FmValidate(document.forms[0]); return false;" OnClick="SubmitBtn_Click" /> My Javascript: Code: function FmValidate(formObj) { var strError = ''; var e = null; if (strError == '' && 'function' == typeof design_validateHtmlForm) { alert('before'); // this line causes execution to stop - located in external JS file // code states "Returns first invalid element, or null." e = design_validateHtmlForm(formObj); alert("e is " + e); if (e) { strError = e.title; } return false; } } In my ASP.NET button, changing the OnClientClick method to "return false" will prevent form submission, but "return FmValidate(formObj);" will not if that function calls design_validateHtmlForm(formObj). I receive the message box saying "before" but I never receive the second one. I have debugged using Fire bug, but the code seems to cycle through each element on the page and stepping through the code is not realistic (I have done so for 20-minute stretches). I am wondering if anyone has any ideas what code I could look for that would stop execution and return true no matter what, or how I could begin debugging this monster. Hey guys, I'm trying to accomplish something similar to what the develop on this site did: http://backlinkwatch.com/ When you click on the text area, a clickable image, with a 50% black opacity background overlay, and an exit either through a link or clicking outside of the box, shows up. I want to accomplish the same thing, but have the image popup show up on the page load instead of requiring a click of the text area. In addition, I would like this popup only once to each IP address; ie, if you visit a page on my site, this will show up, but if you close it and refresh the page or visit another page on the site a cookie will be stored that knows its already been opened once and it won't try to do it again. Thanks to anyone who can help me with this! I was advised by a community member this post would be better suited for the JavaScript section (hope someone can help): The exit pop-up script I have is working fine, other than the fact that it engages on any internal links as well. Below I have the original script I was using along with a modified script sent back to me from someone in another forum. They also advised me to add rel="external" to all of my external links. I'm not sure if a different condition would apply whether the link stayed within my site or went elsewhere. In any event, it's still not working. The changes get me to my desired page on internal links, but the pop-up still engages and I have to click "OK" before it takes me there. I'm obviously looking to get this to work so that all internal links go straight to the page they're defined to, without the pop-up engaging at all. Both script versions are below: My original: Code: <script type="text/javascript"> var internal = 0; function bunload() { if (internal != 1) { window.onbeforeunload = null; alert("******************************************************\n WAIT! WAIT! WAIT! WAIT! WAIT! WAIT!! WAIT!!\n******************************************************\n\nMy partner will probably KICK MY *** for this...\n\nI am secretly giving away a LIMITED number of $20\ncoupons just for Tweeting about us.\n\nIf you act right now, you can grab our Manuscript\nplus ALL Bonuses for just $27!\n\nJust click *CANCEL* on the next window to get your\nV.I.P. discount link!\n\n******************************************************"); window.location = "gift page"; return "******************************************************\n Click CANCEL - Click CANCEL - Click CANCEL \n******************************************************\n\n Click *CANCEL* Now to get your V.I.P. discount!\n\n"; } else { internal = 0; } } if (internal != 1) { window.onbeforeunload = bunload; } else { internal = 0; } </script> And the modified script another community member replied back to use: Code: <script type="text/javascript"> var internal = 0; function bunload() { if (internal != 1) { window.onbeforeunload = null; alert("******************************************************\n WAIT! WAIT! WAIT! WAIT! WAIT! WAIT!! WAIT!!\n******************************************************\n\nMy partner will probably KICK MY *** for this...\n\nI am secretly giving away a LIMITED number of $20\ncoupons just for Tweeting about us.\n\nIf you act right now, you can grab our Manuscript\nplus ALL Bonuses for just $27!\n\nJust click *CANCEL* on the next window to get your\nV.I.P. discount link!\n\n******************************************************"); window.location = "gift page"; return "******************************************************\n Click CANCEL - Click CANCEL - Click CANCEL \n******************************************************\n\n Click *CANCEL* Now to get your V.I.P. discount!\n\n"; } else { internal = 0; } } if (internal != 1) { window.onbeforeunload = bunload; } else { internal = 0; } window.onload = function() { var links = document.getElementsByTagName('a'); for(i = 0 ; i < links.length; i++) { if(links[i].getAttribute('rel') == 'external') { links[i].onclick = function() { bunload(); } } } } </script> Any suggestions on what I'm doing wrong here? My apologies, but my coding isn't very strong and I'm just picking this stuff up as I go. Thanks Hi everyone! I'm trying to make this code run and keep getting the same error. "Could not find the main class: Initials. Program will exit." I'm using jcreator and java is up to date. I really not sure if I posted this in the correct area but any pointer will help. I'm a noob at this so thank you anyone who takes the time out to help me. Thanks in advance code i setup: public class Initials { public static void main(String[] args){ } { System.out.println("JJJJJJ FFFFFF"); System.out.println(" J F"); System.out.prinlLn(" J FFFFF"); System.out.println(" J F"); System.out.println(" J J F"); System.out.println(" JJJJJJ F"); } } Errors: --------------------Configuration: Initials - JDK version 1.6.0_21 <Default> - <Default>-------------------- java.lang.NoClassDefFoundError: Initials Caused by: java.lang.ClassNotFoundException: Initials at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: Initials. Program will exit. Exception in thread "main" Process completed. 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 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'> 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 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, 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... 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! Ok, I today installed IE9 and now my site has lost the main menu. The problem lies in my application.js file code below, any ideas on what may have caused this? When debugging in VS2010 it throws therror at the line prettyPrint(); with the error prettyPrint is underfined? I havent changed anything other than move browser from ie8 to ie9 Code: var submitting = false; $(function(){ $.ajaxSetup({ type: 'POST', dataType: 'json', timeout: 7500, error: function(x, s, t) { //alert(error_message); }, complete: function(){submitting = false;} }); }); $(window).load(function () { // Prittify prettyPrint(); }); /** * toggleLink */ (function($){ $.fn.toggleLink =function (options) { var options = $.extend({ visible: 'view source', invisible: 'hide source' }, options); return this.each(function(i, e) { $(e).click(function (event) { event.preventDefault(); var $this = $(this); var obj = $('#' + $this.attr('rel')); if (obj.is(':visible')) { obj.hide(); $this.text(options.visible); } else { obj.show(); $this.text(options.invisible); } }); }); } })(jQuery); /** * toggleLinkAll */ (function($){ $.fn.toggleLinkAll =function (options) { var options = $.extend({ visibleAll: 'view all sources', invisibleAll: 'hide all sources', visible: 'view source', invisible: 'hide source', children: '#things a.showSource' }, options); return this.each(function(i, e) { $(e).click(function (event) { event.preventDefault(); var $this = $(this); var v = $this.data('visible'); var visible = (typeof v == 'undefined' || v == true); $(options.children).each(function () { var $t = $(this); var id = $t.text((visible) ? options.invisible: options.visible).attr('rel'); if (visible) { $('#' + id).show(); } else { $('#' + id).hide(); } }); if (visible) { $this.text(options.invisibleAll).data('visible', false); } else { $this.text(options.visibleAll).data('visible', true); } }); }); } })(jQuery); /** * paginate */ (function($){ $.fn.paginate =function (options) { var options = $.extend({ type: 'GET', dataType: 'html', timeout: 7000, success: null }, options); return this.each(function(i, e) { $(e).click(function() { var $this = $(this); $this.parent('div') .html('<img src="/images/loading.gif" class="valign_middle"/> ' + '<span class="green">loading...</span>'); options.url = $this.attr('href'); $.ajax(options); return false; }); }); } })(jQuery); /** * Destroyer */ (function($){ $.fn.destroyer =function (options) { var options = $.extend({ progressMessage: 'deleting...', completeMessage: 'deleted!', errorMessage: 'Sorry, an error occured.' }, options); var destroy = function() { var $this = $(this); var token = $this.attr('rel').split('_'); var type = token[0]; var key = token[1]; var msg = 'Sure you want to delete this ' + type + '? There is NO undo!'; if (!window.confirm(msg)) return false; var parent = $(this.parentNode); var container = $('#' + type + '_' + key); $.ajax({ type: 'POST', url: '/' + type + '/' + key + '/delete/', beforeSend: function(){ parent.html(options.progressMessage + '...'); }, dataType: 'json', data: {_method: 'delete'}, timeodut: 6000, success: function(obj){ if(obj.error){alert(options.errorMessage);} else if(obj.success){ if (container.length > 0) { container.hide(); } else if (obj.redirect) { window.location = obj.redirect; } else {window.location = '/';} } else { alert(options.errorMessage); } }, error: function () { alert(options.errorMessage); } }); return false; } return this.each(function(i, e) { $(e).click(destroy); }); } })(jQuery); Hi, I have html variable as below: html += "<div class='quickSearchResultDivUnselected' style='width:" + divWidh + "px;max-width:" + divWidh + "px'><a href='#' OnClick='javascript:test('" + title + "')>" + title + "</a></div>"; The problem is with OnClick='javascript:test('" + title + "')>". How to make this link as <a OnClick='javascript:test("VALUE")'></a>, because now as result it looks like this and it doesn't work: <a OnClick='javascript:test('value')'></a>; So the problem is with ' and ". How to make it correctly in this long line of html variable ? Please help. 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(); }); 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> Hey guys! :-) How do i translate this javascript sentense in to "real working" javascript. PHP Code: if(a1 "its a box/this is just for info" = got a value written){ c1 also a box = disabled; } How do i write this so it works? My first thought was: PHP Code: if(document.GetElementById(a1).value = true){ document.GetElementById(c1).disabled = true; } But cant get it working - is there somebody there could help me? :-) //Morten Larsen // Denmark. |