JavaScript - Table Row Count With Subtables
I have a table that has multiple subtables built into it, I need to get a count of the number of rows only on the main table, I tried using document.getElementById('tableID').rows.length but that returns 91 rows (its reading all the subtables), the main table is built from a cold fusion page so the length of the table varies depending on your selection.
I've been searching around for a bit but have had no luck, Any help would be appreciated. Similar TutorialsI would like to be able to write a function (or something) to count the number of rows in the table, I don't know how to do it, any help is appreciated.
Hi, I am not a Javascript programmer and I am facing some barriers. Maybe some of you could help me. I would need a script that can be used to count down until any given date with hour, minutes and seconds. For example: Quote: September 10, 2009 16:02:00 Bob Kuspe I've been looking everywhere for a script that counts up from 1 to 10, but can't find anything. I even searched the forums. Basically just something that starts from 1 and then replaces itself with 2, and so on. Thanks! Deleted
I would like to count how many duplicate values I have in an array. My below attempt doesnt count the duplicate values: Code: var ct = 0; for(var i = 0;i < myArray.length;i++) { var myData = getData[i].city; if(myData == myData) { ct++; } alert("Total Count = " + ct); } Please advise the best way to do this. hi i am new to javascript. i make a mcq quiz website in one of server side script. now for that website i want to make count down timer so when that quiz starts the user will have 5 minutes to complete that quiz if use does not able to complete quiz in given time then quiz should disable and shows the user score how can i achieve this Hi, I want to do a redirect count so that the user can see the count going down. for example, I want them to be able to see the following. You will be redirected in 5 seconds. The user should be able to see the count going down from 5 to 4 to 3 to 2 to 1 and then they are redirected. I can get the page to redirect after 5 seconds but I want the user to be able to see it count down. Thanks in advance for your help Hi All, Not sure if you can help, I'm having some issues with a count down timer that outputs a time until deadline. It was all working fine however since the clocks have gone back in the UK it is a hour out. However I was under the impression that the UTCHours called GMT time with the clocks going forward & backwards. - if this is not the case how do I call the correct GMT time or the server time? The server time is correct however the script displays the wrong message. Here is the script: [JavaScript] var lastimage = ""; function checkTimer() { function b(a, b, c) { - Pastebin.com Thanks! Hello, I have this script (which i didn't program) which is suppose to count down an amount of time, and then redirect the page to another place. It works fine on IE/Opera but it doesn't on Netscape/Mozilla. I was wondering if any one could tell me the couse or another script that will work on most browsers. Thanks a lot Code: time_in_sec = 300; function nextSec() { m = Math.floor(time_in_sec / 60); s = time_in_sec % 60; if (s < 10) { s = "0" + s; } if ((m == 0)&&(s == 0)) { location.replace("SOME_URL"); } else { document.all.counter.innerHTML = '<font style="font-size: 13pt" color="#999999">' + m + ":" + s + "</font>"; window.setTimeout('nextSec()',1000); } time_in_sec--; } I've downloaded a simple wysiwyg script from the internet, however I want to add a wordcounter to it. The main idea is that the amount of words is refreshed every time a new character is entered. However I haven't got a clue on how to implement this, I've used javascript a lot a few years ago.. but this is out of my league. So I'm hoping someone can help me with this. The html file: Quote: <html> <head> <style type="text/css">@import url('SimpleTextEditor.css');</style> <script src="SimpleTextEditor.js"></script> <script type="text/javascript"> function countWords(){ document.form1.wordcount.value = document.form1.inputString.value.split(' ').length + '/300 words'; if (document.form1.inputString.value.split(' ').length >= 50){ document.getElementById("wordcount").style.color = "red"; }else{ document.getElementById("wordcount").style.color = "black"; } } </script> </head> <body> <form name="form1" method="post"> <div style="height:34px;width:750px;margin-bottom:5px;background-image:url('mainbar.png');background-repeat:no-repeat; "><input style="margin-top:6px;margin-left:25px;" name="wordcount" type="text" value="" size="6"></div> <textarea name="inputString" id="inputString" cols="70" rows="4" onkeyup='countWords();'></textarea> <br> <script> var ste = new SimpleTextEditor("inputString", "ste"); ste.cssFile = 'test.css'; ste.charset = 'iso-8859-1'; ste.init(); </script> <input type="submit" value="submit" onclick="ste.submit();"> </form> </body> </html> The javascript file: Quote: function SimpleTextEditor(id, objectId) { if (!id || !objectId) { alert("SimpleTextEditor.constructor(id, objectId) failed, two arguments are required"); } var self = this; this.id = id; this.objectId = objectId; this.frame; this.viewSource = false; this.path = ""; // with slash at the end this.cssFile = ""; this.charset = "iso-8859-1"; this.editorHtml = ""; this.frameHtml = ""; this.textareaValue = ""; this.browser = { "ie": Boolean(document.body.currentStyle), "gecko" : (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) }; this.init = function() { if (document.getElementById && document.createElement && document.designMode && (this.browser.ie || this.browser.gecko)) { // EDITOR if (!document.getElementById(this.id)) { alert("SimpleTextEditor "+this.objectId+".init() failed, element '"+this.id+"' does not exist"); return; } this.textareaValue = document.getElementById(this.id).value; var ste = document.createElement("div"); document.getElementById(this.id).parentNode.replaceChild(ste, document.getElementById(this.id)); ste.id = this.id+"-ste"; ste.innerHTML = this.editorHtml ? this.editorHtml : this.getEditorHtml(); // BUTTONS var buttons = ste.getElementsByTagName("td"); for (var i = 0; i < buttons.length; ++i) { if (buttons[i].className == "button") { buttons[i].id = this.id+'-button-'+i; buttons[i].onmouseover = function() { this.className = "button-hover"; } buttons[i].onmouseout = function() { this.className = this.className.replace(/button-hover(\s)?/, "button"); } buttons[i].onclick = function(id) { return function() { this.className = "button-hover button-click"; setTimeout(function(){ document.getElementById(id).className = document.getElementById(id).className.replace(/(\s)?button-click/, ""); }, 100); } }(buttons[i].id); } } // FRAME if (this.browser.ie) { this.frame = frames[this.id+"-frame"]; } else if (this.browser.gecko) { this.frame = document.getElementById(this.id+"-frame").contentWindow; } this.frame.document.designMode = "on"; this.frame.document.open(); this.frame.document.write(this.frameHtml ? this.frameHtml : this.getFrameHtml()); this.frame.document.close(); insertHtmlFromTextarea(); } }; function lockUrls(s) { if (self.browser.gecko) { return s; } return s.replace(/href=["']([^"']*)["']/g, 'href="simpletexteditor://simpletexteditor/$1"'); } function unlockUrls(s) { if (self.browser.gecko) { return s; } return s.replace(/href=["']simpletexteditor:\/\/simpletexteditor\/([^"']*)["']/g, 'href="$1"'); } function insertHtmlFromTextarea() { try { self.frame.document.body.innerHTML = lockUrls(self.textareaValue); } catch (e) { setTimeout(insertHtmlFromTextarea, 10); } } this.getEditorHtml = function() { var html = ""; html += '<input type="hidden" id="'+this.id+'" name="'+this.id+'" value="">'; html += '<table class="ste" cellspacing="0" cellpadding="0">'; html += '<tr><td class="bar"><table id="'+this.id+'-buttons" cellspacing="0" cellpadding="0"><tr>'; //html += '<td><select onchange="'+this.objectId+'.execCommand(\'formatblock\', this.value);this.selectedIndex=0;"><option value=""></option><option value="<h1>">Heading 1</option><option value="<h2>">Heading 2</option><option value="<h3>">Heading 3</option><option value="<p>">Paragraph</option><option value="<pre>">Preformatted</option></select></td>'; //html += '<td><div class="separator"></div></td>'; html += '<td class="button"><img src="'+this.path+'images/bold.gif" width="20" height="20" alt="Bold" title="Bold" onclick="'+this.objectId+'.execCommand(\'bold\')"></td>'; html += '<td class="button"><img src="'+this.path+'images/italic.gif" width="20" height="20" alt="Italic" title="Italic" onclick="'+this.objectId+'.execCommand(\'italic\')"></td>'; html += '<td class="button"><img src="'+this.path+'images/underline.gif" width="20" height="20" alt="Underline" title="Underline" onclick="'+this.objectId+'.execCommand(\'underline\')"></td>'; html += '<td><div class="separator"></div></td>'; html += '<td class="button"><img src="'+this.path+'images/left.gif" width="20" height="20" alt="Align Left" title="Align Left" onclick="'+this.objectId+'.execCommand(\'justifyleft\')"></td>'; html += '<td class="button"><img src="'+this.path+'images/center.gif" width="20" height="20" alt="Center" title="Center" onclick="'+this.objectId+'.execCommand(\'justifycenter\')"></td>'; html += '<td class="button"><img src="'+this.path+'images/right.gif" width="20" height="20" alt="Align Right" title="Align Right" onclick="'+this.objectId+'.execCommand(\'justifyright\')"></td>'; html += '<td><div class="separator"></div></td>'; html += '<td class="button"><img src="'+this.path+'images/ol.gif" width="20" height="20" alt="Ordered List" title="Ordered List" onclick="'+this.objectId+'.execCommand(\'insertorderedlist\')"></td>'; html += '<td class="button"><img src="'+this.path+'images/ul.gif" width="20" height="20" alt="Unordered List" title="Unordered List" onclick="'+this.objectId+'.execCommand(\'insertunorderedlist\')"></td>'; html += '<td><div class="separator"></div></td>'; html += '<td class="button"><img src="'+this.path+'images/outdent.gif" width="20" height="20" alt="Outdent" title="Outdent" onclick="'+this.objectId+'.execCommand(\'outdent\')"></td>'; html += '<td class="button"><img src="'+this.path+'images/indent.gif" width="20" height="20" alt="Indent" title="Indent" onclick="'+this.objectId+'.execCommand(\'indent\')"></td>'; //html += '<td><div class="separator"></div></td>'; //html += '<td class="button"><img src="'+this.path+'images/link.gif" width="20" height="20" alt="Insert Link" title="Insert Link" onclick="'+this.objectId+'.execCommand(\'createlink\')"></td>'; //html += '<td class="button"><img src="'+this.path+'images/image.gif" width="20" height="20" alt="Insert Image" title="Insert Image" onclick="'+this.objectId+'.execCommand(\'insertimage\')"></td>'; //html += '<td><div class="separator"></div></td>'; //html += '<td class="button"><img src="'+this.path+'images/help.gif" width="20" height="20" alt="Help" title="Help" onclick="'+this.objectId+'.openWindow(\''+this.path+'help.html\', \'300\', \'300\')"></td>'; html += '</tr></table></td></tr>'; html += '<tr><td class="frame"><iframe id="'+this.id+'-frame" frameborder="0"></iframe></td></tr>'; html += '<tr><td class="source"><input id="'+this.id+'-viewSource" type="checkbox" onclick="'+this.objectId+'.toggleSource()"> View Source</td></tr>'; html += '</table>'; return html; }; this.getFrameHtml = function() { var html = ""; html += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; html += '<html><head>'; html += '<meta http-equiv="Content-Type" content="text/html; charset='+this.charset+'">'; html += '<title>SimpleTextEditor frame</title>'; html += '<style type="text/css">pre { background-color: #eeeeee; padding: 0.75em 1.5em; border: 1px solid #dddddd; }</style>'; if (this.cssFile) { html += '<link rel="stylesheet" type="text/css" href="'+this.cssFile+'">'; } html += '<style type="text/css">html,body { cursor: text; } body { margin: 0.5em; padding: 0; }</style>'; html += '</head><body></body></html>'; return html; }; this.openWindow = function(url, width, height) { var x = (screen.width/2-width/2); var y = (screen.height/2-height/2); window.open(url, "", "scrollbars=yes,width="+width+",height="+height+",screenX="+(x)+",screenY="+y+",left="+x+",top=" +y); }; this.toggleSource = function() { var html, text; if (this.browser.ie) { if (!this.viewSource) { html = this.frame.document.body.innerHTML; this.frame.document.body.innerText = unlockUrls(html); document.getElementById(this.id+"-buttons").style.visibility = "hidden"; this.viewSource = true; } else { text = this.frame.document.body.innerText; this.frame.document.body.innerHTML = lockUrls(text); document.getElementById(this.id+"-buttons").style.visibility = "visible"; this.viewSource = false; } } else if (this.browser.gecko) { if (!this.viewSource) { html = document.createTextNode(this.frame.document.body.innerHTML); this.frame.document.body.innerHTML = ""; this.frame.document.body.appendChild(html); document.getElementById(this.id+"-buttons").style.visibility = "hidden"; this.viewSource = true; } else { html = this.frame.document.body.ownerDocument.createRange(); html.selectNodeContents(this.frame.document.body); this.frame.document.body.innerHTML = html.toString(); document.getElementById(this.id+"-buttons").style.visibility = "visible"; this.viewSource = false; } } document.getElementById(this.id+"-viewSource").checked = this.viewSource ? "checked" : ""; document.getElementById(this.id+"-viewSource").blur(); }; this.execCommand = function(cmd, value) { if (cmd == "createlink" && !value) { var url = prompt("Enter URL:", ""); if (url) { this.frame.focus(); this.frame.document.execCommand("unlink", false, null); if (this.browser.ie) this.frame.document.execCommand(cmd, false, "simpletexteditor://simpletexteditor/"+url); else if (this.browser.gecko) this.frame.document.execCommand(cmd, false, url); this.frame.focus(); } } else if (cmd == "insertimage" && !value) { var imageUrl = prompt("Enter Image URL:", ""); if (imageUrl) { this.frame.focus(); this.frame.document.execCommand(cmd, false, imageUrl); this.frame.focus(); } } else { this.frame.focus(); this.frame.document.execCommand(cmd, false, value); this.frame.focus(); } }; this.isOn = function() { return Boolean(this.frame); }; this.getContent = function() { try { return unlockUrls(this.frame.document.body.innerHTML); } catch(e) { alert("SimpleTextEditor "+this.objectId+".getContent() failed"); } }; this.submit = function() { if (this.isOn()) { if (this.viewSource) { this.toggleSource(); } document.getElementById(this.id).value = this.getContent(); } }; } As you can see there are a few lines I wrote myself in the HTML file, but they didn't do the trick. Hi I'm looking for ways to limit the textarea input, I dont want people to enter hundreds of lines cause, i only want them to enter max. 10 lines. I've looked at several javascripts (cause the problem only can be solved by javascript), and came up with this script: http://javascript.internet.com/forms...-textarea.html . It works great and even has a counter how many characters are left to type in. However when I copy paste something, the 'counter' doesnt adjust right away...it does when I try to type in something extra though. Is it possible to make the counter adjust automaticly whenever there is pasted ? I guess you guys have to test to see what I mean. Thanks in advance !! I've reading this forum for some time now and this is my first post. I hope to find an helpfull community here and to be able to help other users myself. I'm new to JS so this might be an simple question: I have an form that can be filled bij an user, some fields are calculated by Javascript. I need an code to be able to calculate 'live' the totals of the fields in the loop, that fields are the grey fields at the borro. This is (part of) my form: PHP Code: <table align="center" class="bd" border="0" cellspacing="1" cellpadding="2" width="500"> <tr> <td>Bewerking</td> <td>Prijs per uur</td> <td>Aantal uur</td> <td align="center">Totaal</td> <td>Opmerkingen</td> </tr> <?php for ($i=0; $i<=$bew_aantal_regels_corr; $i++) { ?> <tr> <td><?php if($error_bew_vergeten[$i] == "ja"){ $error_omschr = $error_omschr_bew_vergeten[$i]; include('includes/input_error.php'); } ?> <select name="bewerking[]" onChange="bew_uren(this, <?php echo $i ?>),bew_uren_tot(this, <?php echo $i ?>)"> <option></option> <?php $sql_bewerking = "SELECT omschrijving, tarief from sp_calc_werkzaamheden ORDER BY omschrijving ASC"; $res_bewerking = mysql_query($sql_bewerking,$con); while ($row_bewerking = mysql_fetch_assoc($res_bewerking)){ ?> <option <?php if($row_bewerking["omschrijving"] == $bew_omschr[$i]){ echo 'selected="selected"'; } ?> value=<?php echo $row_bewerking["tarief"] ?>><?php echo $row_bewerking["omschrijving"] ?></option> <?php } ?></select> <input type="hidden" name="bew_omschr[]" value="<?php if($bew_omschr[$i] != ''){ echo $bew_omschr[$i]; } ?>" /> </td> <td><input type="text" name="bew_tarief[]" onKeyup="bew_uren_tot(this, <?php echo $i ?>)" size="5" style="text-align:right" value="<?php if($bew_tarief[$i] != ''){ echo $bew_tarief[$i]; } ?>" /><?php if($error_bew_tarief[$i] == "ja"){ $error_omschr = $error_omschr_bew_tarief[$i]; include('includes/input_error.php'); } ?></td> <td><input type="text" name="bew_uren[]" onKeyup="bew_uren_tot(this, <?php echo $i ?>)" size="5" style="text-align:right" value="<?php if($bew_uren[$i] != ''){ echo $bew_uren[$i]; } ?>" /><?php if($error_bew_uren[$i] == "ja"){ $error_omschr = $error_omschr_bew_uren[$i]; include('includes/input_error.php'); } ?></td> <td><input type="text" name="bew_totaal[]" size="10" style="text-align:right;background-color: #f1f1f1" value="<?php if($bew_totaal[$i] != ''){ echo $bew_totaal[$i]; } ?>" readonly="readonly" /></td> <td><input type="text" name="bew_opmerkingen[]" size="75" value="<?php if($bew_opmerkingen[$i] != ''){ echo $bew_opmerkingen[$i]; } ?>" /></td> <td><input type="hidden" name="bew_id[]" value="<?php if($bew_id[$i] != ''){ echo $bew_id[$i]; } ?>" /></td> </tr> <?php } ?> <tr> <td>Regels: <input type="text" name="bew_regels" value="<?php if($bew_aantal_regels != ''){ echo $bew_aantal_regels; } ?>" size="3" /><?php if($error_bew_aantal_regels == "ja"){ $error_omschr = $error_omschr_bew_aantal_regels; include('includes/input_error.php'); } ?> <input type="hidden" name="bew_aantal_regels_oud" value="<?php if($bew_aantal_regels_oud != ''){ echo $bew_aantal_regels_oud; } ?>" size="3" /> <input type="hidden" name="bew_aantal_regels_db" value="<?php if($bew_aantal_regels_db != ''){ echo $bew_aantal_regels_db; } ?>" size="3" /></td> <td></td> <td><input type="text" name="bewerking_tot_uur" size="5" style="text-align:right;background-color: #f1f1f1"" value="<?php if($bewerking_tot != ''){ echo $bewerking_tot; } ?>" readonly="readonly" /></td> <td><input type="text"name="bewerking_tot" size="10" style="text-align:right;background-color: #f1f1f1"" value="<?php if($bewerking_tot_uur != ''){ echo $bewerking_tot_uur; } ?>" readonly="readonly" /></td> </tr> </table> I have a js counter which keeps track of how many chars are in a field on an asp form. When the user clicks a button further down in the form, the form generates more fields. This also causes the js counter to reset to its original value, as the page is 'reloading' in a way. How can I check this value and keep it the same when the user clicks this button? I am including the code I have, if anyone has any ideas/suggestions thanks javascript Code: <asp:Content ID="Content1" ContentPlaceHolderID="headContent" runat="server"> <script type="text/javascript"> //limit of chars var lim = 128; function count(a) { //difference count var dif = lim - a.value.length; while (dif < 0) { a.value = a.value.replace(/.$/, '') dif = lim - a.value.length; } //display difference count document.getElementById('myspan').firstChild.data = dif; } </script> counter in code Code: <asp:TextBox ID="txtHeadline" runat="server" Width="600px" MaxLength="128" CssClass="VariableText" onkeyup="count(this)"></asp:TextBox> </td> <td valign="middle" width="160px"> <asp:Label ID="Label14" runat="server" Font-Bold="True" Font-Names="Tahoma" Font-Size="8pt" Text="Characters Remaining: " Width="130px" CssClass="LABEL" Height="16px"></asp:Label> <span id="myspan" Font-Names="Tahoma" Font-Size="8pt">128</span> button Code: <asp:Button ID="btnInitializeTemplate" runat="server" OnClick="btnInitializeTemplate_Click" Text="Initialize Template" CssClass="LABEL" /> i have tried Code: <asp:Button ID="btnInitializeTemplate" runat="server" OnClientClick="return count(document.getElementById('txtHeadline'));" OnClick="btnInitializeTemplate_Click" Text="Initialize Template" CssClass="LABEL" /> it compiles but the value remains reset. any advice on what im doing wrong? Hello all i'm stuck on the last part of my program. Basically it will generate the score and players position but it will no show the following: I'm also having trouble stopping the loop from going over 80 Now add code to your program which will: ! declare and initialise a variable to keep count of how many goes the player takes to get out; ! add one to this count every time the loop is repeated; ! write out the count in a suitable message at the end. Any help is very much appreciated. [CODE] var countMoves = 0; while (playersPosition <80) { playersScore = rollDie(); document.write('Sco ' + playersScore); playersPosition = playersScore + playersPosition; document.write(' squa ' + playersPosition); indexOfNumber = findIndexOf(playersPosition, specialSquaresArray); if (indexOfNumber != -1) { document.write(' ladder to square ' + connectedSquaresArray[indexOfNumber]); document.write('<BR>'); document.write('Sco ' + playersScore); playersScore = connectedSquaresArray[indexOfNumber] + playersScore; document.write(' squa ' + playersScore); playersPosition = playersScore; } document.write('<BR>'); } for (count =1; count <=array.length; count = count + 1) if(array[count] > array[countMoves]) { countMoves = count; } document.write('it took ' + indexOfNumber + 'goes to get out'); [CODE] Hey Guys, I am stuck on something that is probably a straight forward issue. Just can't get my head around it. Basically I have a whole bunch of checkboxes and I want to count the number that have the same class (only when selected) Example: Code: <input type="checkbox" name="Paris" value="FR" /> <input type="checkbox" name="Marseille" value="FR" /> <input type="checkbox" name="Cardiff" value="UK" /> <input type="checkbox" name="London" value="UK" /> <input type="checkbox" name="ROME" value="IT" /> When user checks a checkbox, output the number of checked boxes that have the same value. My thoughts: Code: $("input[type="checkbox"]").click(function(event){ alert($('input[type="checkbox"]:checked').val($('input[type="checkbox"]:checked').val()).length); }); Not sure what the correct logic should be. Anyone with any ideas? How can to obtain length of string variable, for example if I have: var msg = 'hello world!'; Does it exist a method to count string characters? I have a script that almost does what I need: a simple counter that counts inmigrants remmittences to their home countries. Counting starts at 150,000,000,000 and it increments by 35,000 every one minute. The following scripts does the job done but it does not record in a continious manner, it resets each time the page is visited: Here is the code: ( I hope I get some help to make it: no reseting in each page visit) -------------------------------------------------- <html> <head> <script language="javascript" type="text/javascript"> <!-- var startCount = 150000000000; var addPerMin = 35000; function ProcessCounter() { document.getElementById('cnt').innerHTML = addCommas(String(cnt++)); setTimeout('ProcessCounter()', SetTimeOutPeriod); } function PutSpan() { document.write('<span id="cnt"></span>'); } function addCommas(nStr) { var rgx = /(\d+)(\d{3})/; while (rgx.test(nStr)) { nStr = nStr.replace(rgx, '$1' + ',' + '$2'); } return nStr; } var cnt = startCount; var SetTimeOutPeriod = Math.floor((1000 * 60) / addPerMin); function displayCounter() { PutSpan(); ProcessCounter(); } //--> </script> </head> <body <font size="30"> <script language="javascript" type="text/javascript">javascript:displayCounter();</script> </font> </body> Hi Guys, I have a javascript, which counts the specified words.. I want javascript to count some of the html tags and symbols when i enter a html code in the textarea.. - the below searchwords are not functioning properly. http://(space) http:/(space) etc... (no spaces are searching) - www. (.(dot) is not searching, also when i enter wwww(4 times) in the textarea it shows www. as count 1) - i can't enter the below symbols in searchwords array [ < ' ? I thank once again Bullant for helping me on the below script... But i am trying to fix my above issue and i couldn't.. :( Please help me out guys... Here is my Code... Code: <html> <head> <title>Word Count</title> <script type = "text/javascript"> function searchForWords(){ document.getElementById('resultsContainer').innerHTML = ''; var txt = document.getElementById('txtMsg').value; var strWords = document.getElementById('txtSearchWords').value; var searchWordsTokens = strWords.split(' '); var searchWords = ['href','LINK_ID','mailto','src="','src= ','src =','.jpg','.gif','.png','www','www.','http','http:// ','http:/ ','http: ','http ',' http',' "','@','amp;','TBD']; for(i=0; i < searchWordsTokens.length; i++){ if(searchWordsTokens[i].length > 0){searchWords.push(searchWordsTokens[i]);} //remove spaces between words } var results = [],matches; for(i=0; i < searchWords.length; i++){ var regex = new RegExp('\\b'+searchWords[i]+'\\b','gi'); matches = txt.match(regex); results[searchWords[i]] = (matches)? matches.length : 0; } //output results var str = ''; for(var i in results){ str += i+'--'+results[i]+'<br />'; } document.getElementById('resultsContainer').innerHTML = str; } window.onload=function(){ document.getElementById('form_submit').onclick=searchForWords; } </script> </head> <body> <table> <tr><td align="center"> <form id="contact_form"><h4>Paste your HTML Code he </h4> <p><label class="form_label" for='message'></label> <textarea rows="20" cols="60" id="txtMsg"></textarea> </p> <div> <input type="text" id="txtSearchWords"/> </div> <p><input id='form_submit' type="button" value="Check for Counts"></p> <div><p><input id='form_submit' type="reset" value="Clear"></p></div> <div id="resultsContainer"></div> </form><br /></td> </table> </body> </html> Hee guys, I've got a little bit of a problem on my hand. Someone has asked me to help them on a FREE forum host. You have no access to PHP or SQL or anything like that. Just the templates, but even those are really messy! Now on the navagation bar there a PM section (obviously) but the wording they have used is very long and ugly. I was wondering if it would be possible to change the wording whilst still having it show the amount of PM's that you have. If you need anymore information just ask, but I really hope someone can help |