JavaScript - Text Not Being Displayed After Calling A Function. Easy Problem, Please Help!
I'm coding a simple random sentence generator & this is the beginning part of what I'm trying to accomplish.
I created 3 different functions with 3 separate buttons & 3 separate text areas to display the noun, verb, or article once the button is pressed. However, when I press a button, nothing shows up in the text area! Can someone please tell me what I'm doing wrong & give me a fix? It has to be a simple problem, but I am very very new to this & need help. Thanks in advance! Code: <?xml version="1.0" encoding="ISO-8859-1"?> <!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> <script language="JavaScript"> function noun() // Assumes: nothing // Returns: a random noun { return RandomOneOf(["man", "woman", "ball"]); } </script> <script language="JavaScript"> function verb() // Assumes: nothing // Returns: a random noun { return RandomOneOf(["hit", "liked", "smelled"]); } </script> <script language="JavaScript"> function article() // Assumes: nothing // Returns: a random noun { return RandomOneOf(["the", "a", "some"]); } </script> </head> <body> <input type="button" value="Noun" onclick="document.getElementById('OutNoun').value = noun();" /> <TEXTAREA ID="OutNoun" ROWS=1 COLS=15 WRAP VALUE=""></TEXTAREA> <input type="button" value="Verb" onclick="document.getElementById('OutVerb').value = verb();" /> <TEXTAREA ID="OutVerb" ROWS=1 COLS=15 WRAP VALUE=""></TEXTAREA> <input type="button" value="Article" onclick="document.getElementById('OutArticle').value = article();" /> <TEXTAREA ID="OutArticle" ROWS=1 COLS=15 WRAP VALUE=""></TEXTAREA> </body> </html> Similar Tutorials<p> <script type="text/javascript">// <![CDATA[ var metrics = { "mm" : 1, "cm" : 10, "m" : 1000, "inch" : 25.4, "foot" : 304.8 }; function convert(num, dec){ var val = document.getElementById("fromVal").value; if(isNaN(val)){ return } function roundNumber(num, dec) { var result = Math.round( Math.round( num * Math.pow( 10, dec + 1 ) ) / Math.pow( 10, 1 ) ) / Math.pow(10,dec); return result; } document.getElementById("toVal").value = val * metrics[document.getElementById("fromSystem").value]/ metrics[document.getElementById("toSystem").value]; } var interval = null; function watchChanges(){ interval == null ? setInterval("convert()", 500) : clearInterval(interval); } // ]]></script> </p> <table> <tbody> <tr> <td><input id="fromVal" style="width: 100px;" onfocus="watchChanges()" onblur="watchChanges()" type="text" /><select id="fromSystem" onchange="convert()"> <option value="mm">millimeters</option> <option selected="selected" value="cm">centimeters</option> <option value="m">meters</option> <option value="foot">feet</option> <option value="inch">inches</option> </select></td> </tr> <tr> <td colspan="1" align="center">=</td> </tr> <tr> <td><input id="toVal" style="width: 100px;" type="text" disabled="disabled" /><select id="toSystem" onchange="convert()"> <option value="mm">millimeters</option> <option value="cm">centimeters</option> <option value="m">meters</option> <option selected="selected" value="foot">feet</option> <option value="inch">inches</option> </select></td> Hi. Firstly, i apologise for this being a google maps related question but the problem is a regular javascript question i believe, and it's really frustrating me. As i'm sure you're aware that with the maps you can click on a red 'marker' and make an info box pop up. I'm trying to do this with a text link outside of the map. My problem is calling that script via the text link. i really can't see what i'm doing wrong; my html link Code: <a href="javascript;" onmouseover="marker.openInfoWindowHtml();">test</a> and the javascript from the map Code: GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(); }); I'm sure it's something simple but i've been trying variations for hours and I can't get my head around it. Anyone with any ideas would be an absolute star. Cheers, Pat. Hello, I have a code: Code: var device = function(pos_X,pos_Y,serial){ this.pos_x = pos_X; this.pos_y = pos_Y; this.serial_number = serial; this.click = function(){ $("#Control").html("Menu"); }; this.draw = function() { $("#MainArena").append("<div style='position: absolute; top: "+this.pos_y+"px; left: "+this.pos_x+"px;' onclick='"+alert('click')+";'>device</div>"); }; this.move = function(newX, newY) { this.pos_x = newX; this.pos_y = newY; }; [...] <body> <div id="MainArena"></div><div id="Control"></div> devices = new device(100,100,1); devices.draw(); </body> The main problem is in "onclick" in <div> element. This script generates: <div id="1" style="position: absolute; top: 100px; left:100px;" onclick="undefined;">device</div> Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 2</title> </head> <SCRIPT LANGUAGE = JavaScript> function estimateHolidays() { var service1; var service2; var service3; var txtGrade; var txtHolidays; var dblEntitlement; var strService; strService = cmbService.value; if (strService == "Service1") { dblEntitlement = 20; } else if (strService == "Service2" && Grade--"1") { dblEntitlement = 24; } else if (strService == "Service2" && Grade--"2") { dblEntitlement = 26; } else if (strService == "Service2" && Grade--"3") { dblEntitlement = 28; } else if (strService == "Service3") { dblEntitlement = 30; } else { dblEntitlement = "Error! Please try again."; } txtHoliday.value = dblEntitlement; } </SCRIPT> <body> <p> <input name="txtGrade" size="25" value="Enter Your Staff Grade"> </p> <p> Years of Service: <select name="cmbService" size="1"> <option value="Service1">Less than 5 years service</option> <option value="Service2">5 to 9 years service</option> <option value="Service3">10 or more years of service</option> </select> </p> <p> <input type="button" value="Estimate Holidays" name="cmdEstimateHolidays" onclick="estimateHolidays()"> </p> <p> Holiday Entitlement: <input name="txtHolidays" size="25"> </p> </body> </html> Why won't this code work!? Its driving me mad. i have a script that will let you know what the date is.. as well as a countdown to thanksgiving.. it is called tday.js Code: function showDate() { thisDate = new Date(); var thisWDay=thisDate.getDay(); var thisDay=thisDate.getDate(); var thisMonth=thisDate.getMonth(); var thisYear=thisDate.getFullYear(); var mName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October","November", "December"); var wdName = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); return wdName[thisWDay]+", "+mName[thisMonth]+" "+thisDay+", "+thisYear; } function calcThanksgiving(year) { var delta = year - 1900; var tday = delta % 12; tday = (tday + Math.floor(tday/4) + Math.floor(delta/12)) % 7; return (tday == 0)? 28 : (29 - tday); } function daysToThanksgiving() { var thisDate = new Date(); var year = thisDate.getFullYear(); var tday = calcThanksgiving(year); var tdate = new Date("November "+tday+", "+year); if (thisDate > tdate) { year++; tday = calcThanksgiving(year); tdate = new Date("November "+tday+", "+year); } return Math.floor((tdate-thisDate)/(1000*60*60*24)); } so now i have to call upon this script to print "today is ..the date.. . <br> there are ..days... till thanksgiving im kind of new of calling on javascript files but i came up with Code: <SCRIPT LANGUAGE="JavaScript" SRC="tday.js"> </SCRIPT><script type="text/javascript"> document.write('Today is: '+showDate()+'. There are '+daysToThansgiving()+' days until Thanksgiving.'); </script> and it doesnt seem to be working. Can anyonle pls explain me why the return function is not returning the result as intended? I appreciate you help OUTPUT ====== Student : Doe,John eMail : johndoe@gmail.com Course ID : COIN-070B.01 -------------------------------- function task() { var title = ["Assignment1", "Assignment2", "Assignment3", "Assignment4", "Assignment5", "Mid Term", "Finals"]; var points = [30, 30, 28, 27, 29, 41, 45]; for (var i = 0; i < points.length; i++) { titlePoints += title[i] + (" : " + points[i] + "\n"); } return titlePoints; } Code: <head> <title>Variable - Examples 1</title> <script type="text/javascript"> function Student(firstName, lastName, email,courseID){ this.firstName = firstName; this.lastName = lastName; this.email = email; this.courseID = courseID; this.assignments = task; } Student.prototype = { constructor : Student, toString : studentInfo }; function task(){ var title = ["Assignment1","Assignment2","Assignment3","Assignment4","Assignment5","Mid Term", "Finals"] var points = [30, 30, 28, 27, 29,41,45]; var titlePoints = ""; for (var i=0; i < points.length; i++){ titlePoints += title[i] + " : " + points[i] + "\n"; } return titlePoints; } function studentInfo(){ return "Student : " + this.lastName + "," + this.firstName + "<br>"+ "eMail : " + this.email + "<br>" + "Course ID : " + this.courseID + "<br>" + "--------------------------------" + "<br>" + this.assignments; } var student = new Student("John", "Doe", "johndoe@gmail.com","COIN-070B.01"); </script> </head> <body> <script type="text/javascript"> document.writeln(student.toString()); </script> </body> </html> How can I call a PHP Function inside a Javascript Function? This is what I have so far, but I don't think I'm doing it the right way. Any suggestions? PHP Code: <?php function phpQuery(){ $query = mysql_query("INSERT INTO mytable VALUES('','name','email')"); } ?> <script type="text/javascript"> function delayQueries() { timeoutID = window.setTimeout(doQueries, 2000); } function doQueries() { var runQuery = "<?php phpQuery(); ?>"; } </script> Hi, I am working on a google map where you can show lines on the map by checking checkboxes. Lines are displayed according to their category attribute in the xml file. The function that picks up the checkbox click is like this: Code: function boxclick(box,category) { if (box.checked) { show(category); } else { hide(category); } Another part of the code assigns that category attribute to arrows, so that when a line of "x" category is displayed, the relevant arrows are displayed along with it, to indicate directionality. I also have a select list which displays the lines by looping through their array and using selectedIndex in a function called handleSelected2. But I can't get the arrows to display along with the lines from the select box. After trying many, many things, I figure that all I need to do is to call the show(category) function from inside the handleSelected2 function and it should all come together. So I came up with this: Code: function handleSelected2(opt,category) { for (var h = 0; h <gpolylines.length; h++) { gpolylines[h].hide(); } h = opt.selectedIndex - 1; if (h > -1) { gpolylines[h].show(); } for (var v=0; v<pts.length; v++) { show(category); } } which gets me lines, but no arrows. You can see it sort of working he http://www.xelawho.com/map/zonesarrowstest.htm I figure I've got to be close, because if I just tell it to show all the arrows (without going through the category filter) like this: Code: function handleSelected2(opt,category) { for (var h = 0; h <gpolylines.length; h++) { gpolylines[h].hide(); } var h = opt.selectedIndex - 1; if (h > -1) { gpolylines[h].show(); } for (var i=0; i<pts.length; i++) { pts[i].show(); } } then all the arrows show up, as you can see he http://www.xelawho.com/map/zonesarrowstest2.htm I'm not getting any error messages and I've tried pretty much everything I can think of... I've been tweaking this for days and it's driving me crazy. Does anybody else have any ideas? Thanks in advance. Hello, I am fairly new to javascript so patience is appreciated. I have some javascript I need to execute that is located in an SSI footer. The purpose of the code is to find out what domain the page was loaded at and then to tailor some links to match. Because of how the hosting environment is set up (which I have no control over) when the links don't match the domain they aren't included. I also have to use a complete url (as opposed to relative url) because the footer is included in many different web pages. The problem is that the code is executed but it also is displayed as plain text in firefox. The test site is http://test.ci.edina.mn.us Help! The code is: Code: <script type="text/javascript"> var domainName, strOut; domainName = document.domain; strOut = '<link rel="stylesheet" type="text/css" href="http://' + domainName + '/js/jquery.fancybox/jquery.fancybox.css" media="screen" />'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery-1.3.2.min.js" type="text/javascript"></script>'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery.fancybox/jquery.fancybox-1.2.1.js" type="text/javascript"></script>'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery.easing.1.3.js" type="text/javascript"></script>'; document.write(strOut); </script> Is it possible to scrape displayed text you can't find in html source code ? The text shows up only when you click a link, but is still not visible in source code. That link has got a userid and is used as a variable in function ShowUserPhone(userid). If someone knows how to solve this mystery, please help. I added http://www.mediafire.com/file/9eo72u...wUserPhone.txt file as available .js source linked to that smart page. I've also put some comments there about URL original location. Here is the main function where the process started I guess: Code: function ShowUserPhone(userid){ var UserPhoneLink=document.getElementById("UserPhoneLink"); var UserPhone = document.getElementById("UserPhone"); if(document.images){ (new Image()).src="/pp-owners-list-click-counter.asp?UserId="+escape(userid)+"&counterType=detailsphone"; } if (UserPhoneLink){ UserPhoneLink.style.display="none"; } if (UserPhone){ UserPhone.style.display="block"; } } Please help. I am in a class that is right now creating an online quiz that is also displays time. The part I am running into a wall right now is "Call the runClock() function every second, storing the ID of this timed-interval command in the clockId variable." I am unsure how to call it every second. Also, how would I call a function within a function? Here is my code so far: <link href="quiz.css" rel="stylesheet" type="text/css" /> <script src="functions.js" type="text/javascript"></script> <script type="text/javascript"> var seconds = 0 var clockID = function runClock() { clockID = seconds++; document.getElementById("quizclock").value = seconds; } function startClock() { return showQuiz; } </script> </head> I need to create a form button named Create Resume. When clicked this button should call a function that generates a new Web page displaying a resume based on the user input. I am supposed to use the document.write() method to populate a newly generated Web page with all of the XHTML elements, formatting and variable values needed to produce the desired output in Web (.htm) format. I was hoping to get some guidance on how to accomplish this final step on my project. Any help would be greatly appreciated! KM <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Web 115 Final Project</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <script type="text/javascript" src="projectjs.js"> </script> <hr align="center" width="60%" /> </br> <script type="text/javascript"> document.write("<span style=\"font-family:garamond; text-align:center;font-size: 30px;\"> <p><b>Build Your Resume</b></p><\/span>"); </script> <form name="resume" method="get"> <p><input type="text" value="Enter your full name" size="50"/> </p><p> <input type="text" value="Enter your address" size="150"/> </p><p> <input type="text" value="Enter your phone number" size="50"/> </p><p> <input type="text" value="Enter your e-mail address" size="50"/> </p> <script language = "Javascript"> function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ alert("Invalid E-mail ID") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at) ==lstr){ alert("Invalid E-mail ID") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot) ==lstr){ alert("Invalid E-mail ID") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Invalid E-mail ID") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("Invalid E-mail ID") return false } if (str.indexOf(dot,(lat+2))==-1){ alert("Invalid E-mail ID") return false } if (str.indexOf(" ")!=-1){ alert("Invalid E-mail ID") return false } return true } function ValidateForm(){ var emailID=document.resume if ((emailID.value==null)||(emailID.value=="")){ alert("Please Enter your Email ID") emailID.focus() return false } if (echeck(emailID.value)==false){ emailID.value="" emailID.focus() return false } return true } </script> <p> <textarea id="tarea" cols="75" rows="4">Enter your personal information </textarea></p><p> <textarea id="tarea" cols="75" rows="4">Enter your career objectives </textarea></p><p> <textarea id="tarea" cols="75" rows="4">Enter your educational background </textarea></p><p> <input type="text" value="Most recent employment beginning and ending dates" size="50"/></p><p> <textarea id="tarea" cols="75" rows="4">Most recent employment experience</textarea> </p><p> <input type="text" value="Employment beginning and ending dates" size="50"/></p><p> <textarea id="tarea" cols="75" rows="4">Additional Employment Experience</textarea></p><p> <input type="text" value="Employment beginning and ending dates" size="50"/></p><p> <textarea id="tarea" cols="75" rows="4">Additional Employment Experience</textarea></p><p> <input type="text" value="Employment beginning and ending dates" size="50"/></p><p> <textarea id="tarea" cols="75" rows="4">Additional Employment Experience</textarea></p><p> <textarea id="tarea" cols="75" rows="4">Character References</textarea></p><p> <textarea id="tarea" cols="75" rows="4">Business References</textarea></p></br> <input type="button" name="push_button" value="Create Resume"/> </form> </body> </html> I've done a lot of work only to be stuck here at this problem. someone please help: Using the today variable as the parameter value, call the showDateTime() function and store the value returned by the function in the thisDay field of the eventform Web form. what exactly is this asking me to do? would you provide examples please? thanks in advance!@ I would like to call a function within a function. Is this even possible?? When I do this I get "undefined" Here's my code: Code: <html> <head> <script type="text/javascript"> function product(a,b){ total = a*b; display(total); } function display(num){ return num; } </script> </head> <body> <h1>This text I do NOT want to be erased.</h1> <a href="http://google.com" target="_blank">Total: </a> <script type="text/javascript"> product(3,4); document.write(display()); </script> </body> </html> I know you can just return in the first function, "product()" but I would like to do something else in my second function "display()" then return a value. thanks New here. The issue is this: I am trying to display two clocks. I used the javascript clock generator (http://rainbow.arch.scriptmania.com/...generator.html) to create both clocks. However, the same code to place in the html was given to call each clock; <script language="JavaScript">displayTime();</script>. Below is the code for both clocks. What can be changed so that each clock displays on my website? Clock 1: function timeSource(){ x=new Date(timeNow().getUTCFullYear(),timeNow().getUTCMonth(),timeNow().getUTCDate(),timeNow().getUTCHours (),timeNow().getUTCMinutes(),timeNow().getUTCSeconds()); x.setTime(x.getTime()+10800000); return x; } function timeNow(){ return new Date(); } function leadingZero(x){ return (x>9)?x:'0'+x; } function twelveHour(x){ if(x==0){ x=12; } return (x>12)?x-=12:x; } function displayOnTime(){ if(fr==0){ fr=1; document.write('<font size=1 face=verdana><b><span id="tP">'+eval(outputTime)+'</span></b></font>'); } document.getElementById('tP').innerHTML=eval(outputTime); setTimeout('displayOnTime()',1000); } function amPMsymbol(x){ return (x>11)?'pm':'am'; } function fixYear4(x){ return (x<500)?x+1900:x; } var dayNames=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); var monthNames=new Array('January','February','March','April','May','June','July','August','September','October','Novem ber','December'); var fr=0; var outputTime1="dayNames[timeSource().getDay()]+' '+timeSource().getDate()+' '+monthNames[timeSource().getMonth()]+' '+fixYear4(timeSource().getYear())+' '+':'+':'+' '+twelveHour(timeSource().getHours())+':'+leadingZero(timeSource().getMinutes())+':'+leadingZero(tim eSource().getSeconds())+' '+amPMsymbol(timeSource().getHours())"; Clock 2: function timeSource(){ x=new Date(timeNow().getUTCFullYear(),timeNow().getUTCMonth(),timeNow().getUTCDate(),timeNow().getUTCHours (),timeNow().getUTCMinutes(),timeNow().getUTCSeconds()); x.setTime(x.getTime()+daylightSaving()-18000000); return x; } function timeNow(){ return new Date(); } function daylightSaving(){ return ((timeNow().getTime()>findDay(0,2,3,2).getTime())&&(timeNow().getTime()<findDay(0,10,3,1).getTime()) )?3600000:0; } function findDay(d,m,h,p){ var week=(p<0)?7*(p+1):7*(p-1),nm=(p<0)?m+1:m,x=new Date(timeNow().getUTCFullYear(),nm,1,h,0,0),dOff=0; if(p<0){ x.setTime(x.getTime()-86400000); } if(x.getDay()!=d){ dOff=(x.getDay()<d)?(d-x.getDay()):0-(x.getDay()-d); if(p<0&&dOff>0){ week-=7; } if(p>0&&dOff<0){ week+=7; } x.setTime(x.getTime()+((dOff+week)*86400000)); } return x; } function leadingZero(x){ return (x>9)?x:'0'+x; } function twelveHour(x){ if(x==0){ x=12; } return (x>12)?x-=12:x; } function displayTime(){ if(fr==0){ fr=1; document.write('<font size=2 face=Arial><b><span id="tP">'+eval(outputTime)+'</span></b></font>'); } document.getElementById('tP').innerHTML=eval(outputTime); setTimeout('displayTime()',1000); } function amPMsymbol(x){ return (x>11)?'pm':'am'; } function fixYear4(x){ return (x<500)?x+1900:x; } var dayNames=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); var monthNames=new Array('January','February','March','April','May','June','July','August','September','October','Novem ber','December'); var fr=0; var outputTime="dayNames[timeSource().getDay()]+' '+timeSource().getDate()+' '+monthNames[timeSource().getMonth()]+' '+fixYear4(timeSource().getYear())+' '+':'+':'+' '+twelveHour(timeSource().getHours())+':'+leadingZero(timeSource().getMinutes())+':'+leadingZero(tim eSource().getSeconds())+' '+amPMsymbol(timeSource().getHours())"; hi guys, this is a simple js ,there are 3 color block, when the mouse hover over one of them ,other one the forth block's color change, acorrding to the 3 color block.i want to simplified this js,cause the color repeat twice. Code: <html> <head> <script type="text/javascript" > function tdchangeColor(color){ document.getElementById("input").style.backgroundColor=color } </script> </head> <body> <div style="width:30px;height:30px;background:red;float:left;" onmouseover="tdchangeColor('red')"></div> <div style="width:30px;height:30px;background:blue;float:left;" onmouseover="tdchangeColor('blue')"></div> <div style="width:30px;height:30px;background:green;float:left;" onmouseover="tdchangeColor('green')"></div> <br><br> <input type="text" id="input"> </body> </html> Hello, I'm looking for help as I have the jCarouselLite feature functioning on my website and am looking for a way of displaying another image to the right of the carousel, dependent upon which image is visible in the carousel. I toyed with the idea of implementing another snippet of JavaScript to swap the text to the right and manually synching the swap time wise, but quickly abandoned this idea for a number of reasons, particularly as the carousely has buttons to scroll through the images displaying. I have to admit I'm not particularly great with JavaScript, but was thinking along the lines of another function that listens for the image that is displayed, but have no idea if am way off the mark, or even if this is the right track - no idea how to implement. Any help would be very gratefully recieved. Thanks, Matt var macs = { getMacAddress : function() { document.macaddressapplet.setSep( "-" ); document.write( "Mac Address = " + document.macaddressapplet.getMacAddress() ); } how do i call this function and display out in the website? this doesn't seems working.. <script type="text/javascript"> document.write(mac.getMacAddress()); </script> Anyone help? Code: <form> <input type="button" value="Click!" id="001" /> </form> function one() { window.alert('Hello'); window.alert('World!'); } var varname=document.getElementById("001"); varname.onclick=one; I am not sure if the last line is this example is correct. Should it not be: varname.onclick=one(); Or is it ok to write it either way? Thanks. Hi, I would like to do something like this: Code: function searchLocations(count) { var found = false; var input = document.getElementById('autocomplete').value; var inp = input.toLowerCase(); var count = 0; for (var j = 0; j < gmarkers.length; j++) { gmarkers[j].hide(); var str=gmarkers[j].myname.toLowerCase(); var patt1=inp; if (str.match(patt1)) { found = true; gmarkers[j].show(); count++; } } if (count==1) myclick(j); if (count>1) centerZoom(); if ( ! found ) alert("No matches found. Please check your spelling or refine your search."); } on this page here, but the functions - myclick(j); and centerZoom(); aren't getting called. I tried it with switches here, but that only made things worse. I know the functions work because if I put them two } up, they get called, but that takes them out of the if statements. Those if (count...) statements have to be where they are so that "count" will get the right value. Any ideas? |