finding something in an array - JavaScript Help


From a little hunting around I found this (no, not from W3):

var TMS_evt_names = [""]; function chkEvent(i) { choice = document.getElementById("evt"+i).value.toUpperCase(); alert("in chkevent with "+choice); idx = TMS_evt_names.indexOf(choice); if (idx < 0) { alert("invalid event"); return false; } else { alert("found "+TMS_evt_names[choice]); return true; } }
The array in the first line is being built, since I can see it in my browser.

My problem is - when I run it and the function is called, IE tells me the the line with the indexof reference "doesn't support this property of method". I do note that in most examples using indexOf that the arg is a string constant, rather than a variable. How do I get the variable to work in this instance. I already tried using "indexOf(choice.value)" but that didn't work either.
Posted On: Tuesday 1st of January 2013 11:58:32 PM Total Views:  69
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




CheckForm function not working

Here's the situation. I have a questionnaire where each question id is "q(Question number)".. e.g. q1 in ascending order. This was so that I could check all the questions in a WHILE statement, rather than going tediously through 13 questions... My problem is this function I'm using to check the form seems to not work and I don't know what's wrong with it. relating code has been posted here to show you my method. Note: Question 3 has a 3a and 3b question (ids are q3.1 and q3.2) Though it is not required 3.1 is answered unless the value from question 3 is 0 or -1. Note: Question 8 and 10 work similarly but they are a "Yes/No" question, so it's a boolean. If either of them have a 1, then q8.1 or q10.1 are required. Note: This function was on an onsubmit in the tag. (Random Related Question: If one Javascript function doesn't work, does it also make all the other javascript nonfunctional That seems to be the case here.) So can someone help point out what's wrong here if (document.layers) { browserType = "nn4" } else if (document.all) { browserType = "ie" } else { browserType= "gecko" } function safeGetElement(id) { if (browserType == "gecko" ) return eval("document.getElementById('" + id + "')"); else if (browserType == "ie") return eval("document.getElementById('" + id + "')"); else return eval("document.layers['" + id + "']"); } function FormCheck() { var question = 1; var quid="q" + question; var error; while (question
VIEWS ON THIS POST

152

Posted on:

Wednesday 21st November 2012
View Replies!

modular javascript

hi i got a little problem i wanna separate definitively the html and javascript exemple this my html page xxx this the text that i wanna get and this the javascript x.js var x=document.getElementById("p"); alert(x); but it doesn't work ... i think i know why : it didn't parse the document yet i've tried to addEventListener("load","myFunction",false); but nothing happend 'd please help me This post has been edited by xmerou: 16 April 2011 - 02:07 PM
VIEWS ON THIS POST

43

Posted on:

Wednesday 21st November 2012
View Replies!

How to copy the data entered in a textbox to a select box using Javasc

I have a web page that has a select box and a textbox to add data into the select box. What I want to do is when I enter some data say a "valid date" in the textbox and click on Add button it should copy the same to the textbox such that ,when I navigate to a different link in the web interface and visit the same page again, the value that I had entered earlier should remain in the select box and be visible. I have been able to copy the data from the textbox to the select box, but when I revisit the same page the value entered earlier does not remain in the page. Once the values are stored in the select box, those values in the select box should be copied to a structure written in C language in the backend. Can anyone tell me how can I store the values entered during runtime in the select box using javascript.
VIEWS ON THIS POST

102

Posted on:

Wednesday 21st November 2012
View Replies!

hw help

can someone clarify how to use random images
VIEWS ON THIS POST

112

Posted on:

Wednesday 21st November 2012
View Replies!

How to fade page

I want to make a button in my page "click here" when i click the page should fade and show some text.then u can close the text box.
VIEWS ON THIS POST

124

Posted on:

Saturday 24th November 2012
View Replies!

About closures in javscript

What is closure in javascript and why we used clousers in javascript.
VIEWS ON THIS POST

148

Posted on:

Saturday 24th November 2012
View Replies!

AJAX/PHP to open a certian window according to the?

Hi , I'm trying to write code where an ajax function, at a specified interval, calls php script to query a table and open a certian window according to the response(variable) received. After that, the ajax function will continue to call the same php script but will open another window only if the response or variable is different from the previous request(s). What kind of method should I use to achieve this
VIEWS ON THIS POST

140

Posted on:

Saturday 24th November 2012
View Replies!

The Message Snake

You probably have seen those message snakes following the cursor on a web page. Well, the javascript code is not too complex, so let's look at it ...
VIEWS ON THIS POST

154

Posted on:

Sunday 25th November 2012
View Replies!

price from dynamic text filed and sum into another?

, I badly need a solution. We have invoice system which take the text fields as s.no, particular, qty, price and amount. the next rows with the same will be created dynamically. the problem for us how to sum amount and display these at the end of the rows.
VIEWS ON THIS POST

166

Posted on:

Sunday 25th November 2012
View Replies!

JavaScript all browser support

I have written my first javascript block which functions correctly in IE, however nothing executes in FF or chrome. have I missed something. Also is there a way to stop IE from prompting to run it TIA Javascript function getCondition() { if (window.XMLHttpRequest) {// code for ie7+, firefox, chrome, opera, safari xmlhttp=new XMLHttpRequest(); } else {// code for ie6, ie5 xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP"); } xmlhttp.open("GET","http://www.google.com/ig/apiweather=invercargill",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; i=0; var x=xmlDoc.getElementsByTagName("current_conditions"); var c=(x[i].getElementsByTagName("condition")[0].getAttribute("data")); var t=(x[i].getElementsByTagName("temp_c")[0].getAttribute("data")); var img=(x[i].getElementsByTagName("icon")[0].getAttribute("data")); document.getElementById("tempAPI").innerHTML="It's "+c+" and "+t+"°"; document.getElementById("tempIMG").innerHTML=""; } HTML
VIEWS ON THIS POST

82

Posted on:

Sunday 25th November 2012
View Replies!

Php image gallery with java script

Hi I am new bee to JS and PHP, i have a code to display the images from directory in the path C:\wamp\www\prawin\new\locations\test\admin But this code didnt works . can any one help me. My code is Untitled Document var dimension="3x2" var imagepath="C:/wamp/www/prawin/new/locations/test/admin/" var href_target="new" var popupsetting=[1, "width=500px, height=400px, scrollbars, resizable"] var descriptionprefix=[1, "Photo "] var gsortorder="desc" var targetlinkdir="C:/wamp/www/prawin/new/locations/test/admin/" function sortbydate(a, b){ if (gsortorder=="asc") return new Date(a[1])-new Date(b[1]) else if (gsortorder=="desc") return new Date(b[1])-new Date(a[1]) } if (gsortorder=="asc" || gsortorder=="desc") galleryarray.sort(sortbydate) var totalslots=dimension.split("x")[0]*dimension.split("x")[1] function buildimage(i){ var imagecompletepath=(targetlinkdir!="") targetlinkdir+galleryarray[i][0] : imagepath+galleryarray[i][0] var tempcontainer='' tempcontainer+='' tempcontainer+='' tempcontainer+=(descriptionprefix[0]==1) descriptionprefix[1]+(i+1) : "" return tempcontainer } function jumptopage(p){ var startpoint=(p-1)*totalslots var y=1; for (i=0; i
VIEWS ON THIS POST

150

Posted on:

Sunday 25th November 2012
View Replies!

Statically position Image

I'm trying to position an image statically so that it is always viewable by the user, flush at the bottom of the screen. My problem is that it is off in different browsers / resolutions. Is there another way to do this that I'm not seeing My code is below.
VIEWS ON THIS POST

94

Posted on:

Monday 26th November 2012
View Replies!

determine if font-smoothing is in effect

Is it possible to determine with javascript or other means if the user has any sort of font-smoothing in effect on their os or ua Serif'd fonts don't look so nice on non-smoothed systems, so, i'd rather switch to plain ...
VIEWS ON THIS POST

91

Posted on:

Friday 30th November 2012
View Replies!

hiding-enabling text fields

the following works well regarding one select box with one hidden text box. however I need two unique select boxes with relevant hidden text boxes that un-hide when the Add New option is selected. the problem is that the upper ...
VIEWS ON THIS POST

107

Posted on:

Friday 30th November 2012
View Replies!

permission denied to access window object

I know if the frames/windows can't access properties inside another frame/window that comes from a different domain. But could this call violate the security window.parent if the window comes from a different domain I know it is safe to ...
VIEWS ON THIS POST

121

Posted on:

Friday 30th November 2012
View Replies!

Guidance Request (and a specific question)

I am wondering if JavaScript is a reasonable way to solve my problem. I have to snatch some info from a web page and build a report. Some of the info comes from the web page and some will be ...
VIEWS ON THIS POST

146

Posted on:

Friday 30th November 2012
View Replies!

Is it possible to get the text from browser location bar *before*navigation (e.g. not location.href)

Possibly I am searching for the wrong thing, but my googling has been futile. I want to get the contents of the browser (FF) location bar *before* I have navigated to that location. location.href / window.location have not been ...
VIEWS ON THIS POST

139

Posted on:

Friday 30th November 2012
View Replies!

Anomaly: onblur handling AND advice on validation

Hi; If this is not the proper place to ask these questions please accept my apologies in advance and please let me know where the proper place to ask these questions is. First, it isn't necessary but I was interested ...
VIEWS ON THIS POST

94

Posted on:

Friday 30th November 2012
View Replies!

Long JavaScript processes prevent animated GIFs animation

, I am working on some JavaScript, that amongst other things does searches in an index. The search can take a couple of seconds, and I would like to disable the form button that the user clicked to trigger the ...
VIEWS ON THIS POST

124

Posted on:

Friday 30th November 2012
View Replies!

listbox onchange event question

I have a list box that contains a couple items. I would like to add a confirmation dialog to the onchange event, so if they change the value, it will confirm the change. Here is what I have done in ...
VIEWS ON THIS POST

141

Posted on:

Friday 30th November 2012
View Replies!

Array Help

Hi all, If I have an array with multiple entries that are the same. How can I split them up into separate arrays by this criteria var myArry = ("cars","cars","cars","cars","sticks","sticks","sticks","trees","trees"); The deed result would separate this array into 3 arrays. ...
VIEWS ON THIS POST

140

Posted on:

Friday 30th November 2012
View Replies!

window.open - trying to display a new window with a different title - HELP

I need to open a new window from an existing HTML page to a site in which we do not want to show the address for. I have set the titlebar to no but it will still place the title ...
VIEWS ON THIS POST

138

Posted on:

Friday 30th November 2012
View Replies!

The Round-Trip Time of an XMLHTTP Call?

Hi. Can somebody tell me how to tell how long the round trip will take from client to server and back of an xmlhttp call I want to gauge how long the server code is going to crunch and return ...
VIEWS ON THIS POST

128

Posted on:

Friday 30th November 2012
View Replies!

SkimpyGimpy PNG canvas w/ Javascript mouse tracking

ANN: SkimpyGimpy PNG canvas has Javascript mouse tracking The SkimpyGimpy PNG image canvas now can generate Javascript data structures which allow HTML pages to intelligently respond to mouse events over the image. Please read about the SkimpyGimpy Canvas and look ...
VIEWS ON THIS POST

317

Posted on:

Friday 30th November 2012
View Replies!

how do they hide their html?

http://allwebco-templates.com/templa.../T22dmGolf.htm...
VIEWS ON THIS POST

90

Posted on:

Friday 30th November 2012
View Replies!

Re: Please read - nothing nasty

Not you again. I think this is a little bit off topic here. Your url link does not work, your English is poor, you are being annoying. Please, get a life and stop posting. Why have you posted this to ...
VIEWS ON THIS POST

76

Posted on:

Friday 30th November 2012
View Replies!

passing subarrays (by reference)?

hi, let say i have the following array : var ary = [ [ 'Directory', 'type', 'href', 'tip', ['file', 'type', 'href', 'filetip' ], ['file2', 'type2', 'href', 'filetip' ], ], [ 'Dir2', 'href2', 'tipdir2' ] ] I want to send to ...
VIEWS ON THIS POST

91

Posted on:

Friday 30th November 2012
View Replies!

Amazing Javascript SQL database (jsSQLdb) in the browser!!!

Javascript site where you create dynamic web pages in seconds with menus, trees, galleries and more, with simple SQL statements. Webpages are stored as SQL tables and all access to the tables and creation of page objects only use SQL ...
VIEWS ON THIS POST

92

Posted on:

Friday 30th November 2012
View Replies!

How to a JSP application interoperate with a .NET class library

I am developing a class library under Visual C++ .NET. I found out yesterday that a client developing a website to use it is writing JSP pages running on an Apache server on a Windows box. Neither of us knows ...
VIEWS ON THIS POST

123

Posted on:

Friday 30th November 2012
View Replies!

Try on security update from the Microsoft Corporation

...
VIEWS ON THIS POST

102

Posted on:

Friday 30th November 2012
View Replies!

Ubound Error: not defined

I know this can be done, what am I doing wrong If you have form objects on a page with the same name they are automatically put into an array This is what Im trying to accomplish since I do ...
VIEWS ON THIS POST

103

Posted on:

Friday 30th November 2012
View Replies!

Ext JS charts

I'm trying to figure out how to implement one of the charts from the Ext JS framework.. where I get stuck is- I can't find the code that has the data inside the chart. like on exis x- Hits per Month and exis y- month, where is the code that says Jun-40, Jul -79, ect.. if there's a tutorial for using those charts (any kind of chart, just to get the idea) I'd appreciate it.
VIEWS ON THIS POST

111

Posted on:

Sunday 23rd December 2012
View Replies!

How to make page title, auto refresh every x seconds (using javascript

I have a php file lets say file1.php, that printing a variable, its dynamic numbers output that already always increasing, like private message numbers that coming or others : i want to put that variable output, in another files page title, lets say file2.php or file3.html, in the front of the another files page titles, and auto refresh every x seconds, maybe like this : Quote(1) - another text in the page title
VIEWS ON THIS POST

112

Posted on:

Sunday 23rd December 2012
View Replies!

Validation while keypress

i was wandering on how to start the validation in my registration form a validation that wont need to be refreshed that if i fill up a username and entered a invalid keywords the word "You have entered a invalid keyword" will automatically shows up on the right or left or below of that input box.. anyone who can give a code sample about it or help any help would be appreciated ..
VIEWS ON THIS POST

110

Posted on:

Sunday 23rd December 2012
View Replies!

changing textbox text color onclick

i have a textbox thats initial text color is set to grey, i want to change the text color to black when the user clicks on it, is this done by using onclick="style=color:Black;" i have tried this and failed but maybe ive got something slightly wrong or is it done a different way completely. any help would be greatly appreciated.
VIEWS ON THIS POST

66

Posted on:

Sunday 23rd December 2012
View Replies!

replace characters

i am transferring data from one form to another by passing the data into the url, but when i place on the next form it shows up with + signs from the url aswell i have a piece of code in there that should be replacing it with just a space but it doesnt seem to be working, any advice here is my code: function getValue(varname) { \tvar url = window.location.href; \tvar qparts = url.split(""); \tif (qparts.length == 0) \t{ \t\treturn ""; \t} var query = qparts[1]; \tvar vars = query.split("&"); \tvar value = ""; \tfor (i=0;i
VIEWS ON THIS POST

87

Posted on:

Sunday 23rd December 2012
View Replies!

Fields inside Javascript not passing to PHP form submit

I have a multi-page form which will (once it is functional and prettied up) be added to our site to allow prospective students to calculate their estimated cost of attending. Everything works beautifully except the Room and Board area. The code:
VIEWS ON THIS POST

113

Posted on:

Sunday 23rd December 2012
View Replies!

jQuery minor help.

, I am currently working on my website, making a beta version. I've been stumped by what should be a small problem... If any! I've got a comment system, and if you're admin, it places a link under the comment, reading "delete comment", the actual link is; delete comment Now, I'll paste the function. function removeComment(t,id) { //AJAX TO REMOVE COMMENT var str = "#comment_" + id; $(str).fadeOut(); } Now.. That doesn't work. Where it reads "#comment_+id" that's a span tag which holds the comment. But, if I use; function removeComment(t,id) { //AJAX TO REMOVE COMMENT var str = "#comment_" + id; $(t).text("Removed"); } The link actually changes to "Removed", but the comment wont budge.. So, in all. The display is like so; [code] huzi8t9 wrote This is my comment - delete comment Any ideas Any help is appreciated!
VIEWS ON THIS POST

117

Posted on:

Monday 24th December 2012
View Replies!

Lightbox not displaying correctly in IE, works perfectly in FF

, I'm working on making a simple-as-possible lightbox using CSS + JS. When you click the link a bordered box pops up and the page "fades to black". In FF the black layer (which makes it look as if the rest of the page is darkened, like the "Lights Off" feature Hulu has) fades in and out properly and the box displays as the correct size. In IE 6 and 7 this is not the case (not tested with IE 8), the lightbox just appears, the black layer is not even present. Here is my code, maybe someone can give me a hand .black_overlay{ display: none; position: absolute; top: 0%; left: 0%; width: 300%; height: 300%; background-color: #000000; z-index:1001; -moz-opacity: 0.8; opacity: .8; filter:alpha(opacity=80); } .white_content { display: none; position: absolute; top: 25%; left: 25%; width: 50%; height: 50%; padding: 16px; border: 16px solid #3f3f3f; background-color: white; z-index:1002; overflow: auto; } function resetOp() { document.getElementById('dark').style.opacity = 0.0; document.getElementById('dark').style.MozOpacity = 0.0; document.getElementById('dark').style.filters = "alpha(opacity=0)"; } function fadein(alphaWhole) { var d = document.getElementById('dark'); if (alphaWhole == null) { alphaWhole = 0; } if (alphaWhole < 85) { d.style.opacity = alphaWhole/100; d.style.MozOpacity = alphaWhole/100; d.style.filters = "alpha(opacity=" + alphaWhole + ")"; alphaWhole += 5; window.setTimeout("fadein(" + alphaWhole + ")", 10); } else { alphaWhole = 80 } } function fadeout(alphaA) { var d = document.getElementById('dark'); var l = document.getElementById('light'); if (alphaA == null) { alphaA = 80; } if (alphaA === 0) { d.style.display='none'; l.style.display='none'; } else { d.style.opacity = alphaA/100; d.style.MozOpacity = alphaA/100; d.style.filters = "alpha(opacity=" + alphaA + ")"; alphaA -= 5; window.setTimeout("fadeout(" + alphaA + ")", 10); } } function toggleLightbox() { var d = document.getElementById('dark'); var l = document.getElementById('light'); if (d.style.display != 'block' && l.style.display != 'block') { resetOp(); d.style.display='block'; l.style.display='block'; fadein(); } else { fadeout(); } } Show Lightbox Lightbox here Close
VIEWS ON THIS POST

88

Posted on:

Monday 24th December 2012
View Replies!

Chicago-area ExtJS users

Hi , I'm starting an ExtJS user group in the NW Chicago suburbs, and I wanted to invite to our first meeting on Friday June 12. We'll be meeting at the College of Lake County, room T232 at 7:00pm. For our first meeting, we plan on discussing the recent ExtJS Conference, as well as unit testing. Other ideas for topics are certainly welcome! For more information, check out our website: www.chicagoajaxdevelopers.com Hopefully I'll see some of you there. Let me know if you have any questions.
VIEWS ON THIS POST

73

Posted on:

Monday 24th December 2012
View Replies!

Dynamic form with Javascript

I'm trying to put together an expandable (and shrinkable, but that is less important) form using Javascript. I haven't really used Javascript before so I'm going at this with very little experience and I really just want some pointers towards the functions I might need. The basic layout is that I have a text input box, with a + button after it, which will add a second input box with a unique ID. Something similar to what G-mail does with attachements when you're composing a message. My understanding is that I will need to use tags to indicate to the Javascript which bits of the page need to be edited, but I'm not really sure how you use Javascript to change the contents of a tag. The only useful thing I've found is on W3Schools, which does this: document.getElementById('txt').innerHTML=h+":"+m+":"+s But this code replaces the whole of the content of the tag, and I can't figure out if I can change this to just edit the content, or whether I need a completely different method.
VIEWS ON THIS POST

81

Posted on:

Monday 24th December 2012
View Replies!

Filter Not Working - JavaScript Help

Hi Guys, I have 3 dropdown lists here, currently only two of them are working and the third one not. The "call_type_filter and end_user_filter" is working fine, but the "sim_filter" is not working. The sim filter would be numbers such as 901112114154283. Would I need to change any settings for long numbers such as this one Please see my coding below. Please find my javascript and classes attached. Needed to include my class where the function is being called : /* * To change this template, choose Tools | Templates * and open the template in the editor. */ var data = null; var subsetJoined = null; var tableOptions = {'showRowNumber': true}; tableOptions['page'] = 'enable'; tableOptions['pageSize'] = 10; tableOptions['pagingSymbols'] = {prev: 'prev', next: 'next'}; tableOptions['pagingButtonsConfiguration'] = 'auto'; function redrawDashboard(startDate, endDate) { \t\t \t\tdata = google.visualization.arrayToDataTable(getMonsterDataArray(startDate, endDate)); \t\t \t\tdrawSubsetTable(data); \t\tbuildDataTable(null, null); \t\t//call_type_filter \t\t//sim_filter \t\t//end_user_filter \t\tpopulateFilters(getCallTypes(), "call_type_filter"); \t\tpopulateFilters(getSimList(), "sim_filter"); \t\tpopulateFilters(getSubscriberList(), "end_user_filter"); \t\t \t\tdrawLineChart(); } function drawLineChart() { \t\t// subsetJoined \t\t \t\tnew google.visualization.LineChart(document.getElementById('groupLineChart')). \t\tdraw(subsetJoined, {curveType: "function", \t\t\t\t\t\t\t\twidth: 700, height: 300, \t\t\t\t\t\t\t\tvAxis: {maxValue: 10}} \t\t\t\t); } function getCallTypes() { \t\tvar dataView1 = new google.visualization.DataView(data); \t return dataView1.getDistinctValues(1); } function getSimList() { \t\tvar dataView1 = new google.visualization.DataView(data); \t return dataView1.getDistinctValues(2); } function getSubscriberList() { \t\tvar dataView1 = new google.visualization.DataView(data); \t return dataView1.getDistinctValues(4); } function populateFilters(filters, dropDownName) { \t\t// sim_filter \t\tvar dropdown = document.getElementById(dropDownName); \t\tdropdown.options.length = 0; \t\tvar counter = 1; \t\tvar selectOption = new Option(' ALL ', '-1'); \t\tdropdown.options[0] = selectOption; \t\tfor(opt in filters) \t\t{ \t\t\t\tvar selectOption = new Option(filters[opt], filters[opt]); \t\t\t\tdropdown.options[counter] = selectOption; \t\t\t\tcounter++; \t\t} \t\t } function applyFilter(filterFieldIndex, filterValue) { \t\tif(filterValue == '-1') \t\t{ \t\t\t\t// we remove all filters \t\t\t\tvar dataTableVisualization = new google.visualization.Table(document.getElementById('dataTable')); \t\t\t\tdataTableVisualization.draw(data, tableOptions); \t\t\t\tdrawSubsetTable(data); \t\t\t\tdrawLineChart(); \t\t} \t\telse \t\t{ \t\t\t\t// redraw the reports using only the selected filter \t\t\t\t// Create a view that shows hired since 2007. \t\t\t\tvar view = new google.visualization.DataView(data); \t\t\t\t \t\t\t\tview.setRows(view.getFilteredRows([{column: filterFieldIndex, value: filterValue}])); \t\t\t\tvar dataTableVisualization = new google.visualization.Table(document.getElementById('dataTable')); \t\t\t\tdrawSubsetTable(view); \t\t\t\tdrawLineChart(); \t\t\t\tdataTableVisualization.draw(view, tableOptions); \t\t} } function buildDataTable(tableData, tableContainer) { \t\tvar output = ""; \t\tvar rowCounter = 0; \t\tvar heading = ""; \t\t \t\t//data = new google.visualization.arrayToDataTable(getMonsterDataArray()); \t\tvar dataTableVisualization = new google.visualization.Table(document.getElementById('dataTable')); \t\tdataTableVisualization.draw(data, tableOptions); } function drawSubsetTable(dataTableMain) { \t\t// dataTableSubset \t\t//var dataTableMain = google.visualization.arrayToDataTable(getMonsterDataArray()); \t\t \t\t \t\tvar viewIPUsage = new google.visualization.DataView(dataTableMain); \t\tviewIPUsage.setRows(viewIPUsage.getFilteredRows([{column: 3, value: "Data"}])); \t // var dataTableVisualization = new google.visualization.Table(document.getElementById('dataTableSubset')); \t // dataTableVisualization.draw(viewIPUsage, {sortColumn: 1}); \t\t \t\tvar groupIPUsage = google.visualization.data.group( \t\t\tviewIPUsage,, [{'column': 5, 'aggregation': google.visualization.data.sum, 'type': 'number', 'label': 'IP Usage'}]); \t\tvar viewVoiceUsage = new google.visualization.DataView(dataTableMain); \t\t\t\tviewVoiceUsage.setRows(viewVoiceUsage.getFilteredRows([{column: 3, value: "Voice"}])); \t\t// var dataTableVisualization = new google.visualization.Table(document.getElementById('dataTableSubset')); \t\t// dataTableVisualization.draw(viewIPUsage, {sortColumn: 1}); \t\t \t\tvar groupVoiceUsage = google.visualization.data.group( \t\t\tviewVoiceUsage,, [{'column': 5, 'aggregation': google.visualization.data.sum, 'type': 'number', 'label': 'Voice Usage'}]); \t\t\t\t \t\t \t\t var viewStreamingUsage = new google.visualization.DataView(dataTableMain); \t\t\t\tviewStreamingUsage.setRows(viewStreamingUsage.getFilteredRows([{column: 3, value: "Streaming"}])); \t\t// var dataTableVisualization = new google.visualization.Table(document.getElementById('dataTableSubset')); \t\t// dataTableVisualization.draw(viewIPUsage, {sortColumn: 1}); \t\t \t\tvar groupStreamingUsage = google.visualization.data.group( \t\t\tviewStreamingUsage,, [{'column': 5, 'aggregation': google.visualization.data.sum, 'type': 'number', 'label': 'Streaming Usage'}]); \t\t\t\t \t\tvar viewFaxUsage = new google.visualization.DataView(dataTableMain); \t\t\t\tviewFaxUsage.setRows(viewFaxUsage.getFilteredRows([{column: 3, value: "ISDN"}])); \t\t// var dataTableVisualization = new google.visualization.Table(document.getElementById('dataTableSubset')); \t\t// dataTableVisualization.draw(viewIPUsage, {sortColumn: 1}); \t\t \t\tvar groupFaxUsage = google.visualization.data.group( \t\t\tviewFaxUsage,, [{'column': 5, 'aggregation': google.visualization.data.sum, 'type': 'number', 'label': 'Fax/ISDN Usage'}]); \t\t\t\t \t\t \t\tvar viewOtherUsage = new google.visualization.DataView(dataTableMain); \t\t\t\tviewOtherUsage.setRows(viewOtherUsage.getFilteredRows([{column: 3, value: "Other"}])); \t\t// var dataTableVisualization = new google.visualization.Table(document.getElementById('dataTableSubset')); \t\t// dataTableVisualization.draw(viewIPUsage, {sortColumn: 1}); \t\t \t\tvar groupOtherUsage = google.visualization.data.group( \t\t\tviewOtherUsage,, [{'column': 5, 'aggregation': google.visualization.data.sum, 'type': 'number', 'label': 'Other Usage'}]); \t\t\t\t \t\t\tvar formatter = new google.visualization.NumberFormat({fractionDigits:2}); \t\t\tformatter.format(groupIPUsage, 1); \t\t\tformatter.format(groupVoiceUsage, 1); \t\t\tformatter.format(groupStreamingUsage, 1); \t\t\tformatter.format(groupFaxUsage, 1); \t\t\tformatter.format(groupOtherUsage, 1); \t\t\t \t\t\tvar joined_dt = google.visualization.data.join(groupIPUsage, groupVoiceUsage, 'full', [ [0,0]], [1], [1]); \t\t\tvar joined_dt2 = google.visualization.data.join(groupFaxUsage, groupStreamingUsage, 'full', [[0,0]], [1], [1]); \t\t\tvar joined_dt3 = google.visualization.data.join(joined_dt, joined_dt2, 'full', [[0,0]], [1,2], [1,2]); \t\t\tsubsetJoined = google.visualization.data.join(joined_dt3, groupOtherUsage, 'full', [[0,0]], [1,2, 3, 4], [1]); \t\t\t \t var joinedSubTable = new google.visualization.Table(document.getElementById('dataTableSubset')); \tjoinedSubTable.draw(subsetJoined, tableOptions); \t\t//var table = new google.visualization.Table(document.getElementById('dataTableSubset')); \t\t//table.draw(grouped_dt, null); \t\t \t\t } function getMonsterDataArray(startDate, endDate) { \t\tvar reportData = $.ajax({ \t\t\t\t\turl: "getData.phpformat=groupDashboard&startDate=" + startDate + "&endDate=" + endDate, \t\t\t\t\tdataType:"script", \t\t\t\t\tasync: false \t\t\t\t\t}).responseText; \t\t \t\treturn dataArrayDashboard; } \t \t\t \t\t \t\t\tGoogle Visualization API Sample \t\t \t\t \t\t \t\t \t\t \t\t \t\t \t\t\t google.load('visualization', '1', {packages: ['corechart', 'controls', 'table']}); \t\t\tgoogle.setonloadCallback(reloadDashboard); \t\t\t$(function() { $( "#startDate" ).datepicker(); \t\t\t\t\t\t\t\t$( "#endDate" ).datepicker(); }); \t\t\tfunction reloadDashboard() \t\t\t{ \t\t\t\t\tDate.prototype.yyyymmdd = function() { \t\t\t\t\t\tvar yyyy = this.getFullYear().toString(); \t\t\t\t\t\tvar mm = (this.getMonth()+1).toString(); // getMonth() is zero-based \t\t\t\t\t\tvar dd\t= this.getDate().toString(); \t\t\t\t\t\treturn yyyy + "-" + (mm[1]mm:"0"+mm[0]) + "-" + (dd[1]dd:"0"+dd[0]); // padding \t\t\t\t\t\t}; \t\t\t\t\tif( document.getElementById("startDate").value == "" ) \t\t\t\t\t{ \t\t\t\t\t\t\t\tvar startDate = new Date(); \t\t\t\t\t\t\t\tstartDate.setDate(startDate.getDate() - 1);\t \t\t\t\t\t\t\t\tvar endDate = new Date(); \t\t\t\t\t\t\t\tdocument.getElementById("startDate").value = startDate.yyyymmdd(); \t\t\t\t\t\t\t\tdocument.getElementById("endDate").value = endDate.yyyymmdd(); \t\t\t\t\t} \t\t\t\t\telse \t\t\t\t\t{ \t\t\t\t\t\tvar startDate = new Date(document.getElementById("startDate").value); \t\t\t\t\t\tvar endDate = new Date(document.getElementById("endDate").value); \t\t\t\t\t} \t\t\t\t\tredrawDashboard(startDate.yyyymmdd(), endDate.yyyymmdd()); \t\t\t} \t\t\tfunction filterChange(filterId, listName) \t\t\t{ \t\t\t\t\tvar dropDown = document.getElementById(listName); \t\t\t\t\tapplyFilter(filterId, dropDown.value); \t\t\t} \t\t\tfunction exportXls() \t\t\t{ \t\t\t\t\tDate.prototype.yyyymmdd = function() { \t\t\t\t\t\tvar yyyy = this.getFullYear().toString(); \t\t\t\t\t\tvar mm = (this.getMonth()+1).toString(); // getMonth() is zero-based \t\t\t\t\t\tvar dd\t= this.getDate().toString(); \t\t\t\t\t\treturn yyyy + "-" + (mm[1]mm:"0"+mm[0]) + "-" + (dd[1]dd:"0"+dd[0]); // padding \t\t\t\t\t\t}; \t\t\t\t\tif( document.getElementById("startDate").value == "" ) \t\t\t\t\t{ \t\t\t\t\t\t\t\tvar startDate = new Date(); \t\t\t\t\t\t\t\tstartDate.setDate(startDate.getDate() - 1);\t \t\t\t\t\t\t\t\tvar endDate = new Date(); \t\t\t\t\t\t\t\tdocument.getElementById("startDate").value = startDate.yyyymmdd(); \t\t\t\t\t\t\t\tdocument.getElementById("endDate").value = endDate.yyyymmdd(); \t\t\t\t\t} \t\t\t\t\telse \t\t\t\t\t{ \t\t\t\t\t\tvar startDate = new Date(document.getElementById("startDate").value); \t\t\t\t\t\tvar endDate = new Date(document.getElementById("endDate").value); \t\t\t\t\t} \t\t\t\twindow.open('getData.phpformat=xls&startDate=' + startDate.yyyymmdd() + '&endDate=' + endDate.yyyymmdd()); \t\t\t} \t\t \t \t \t\t\t \t\t\t\t\t \t\t\t\t\t\t\tStart Date: \t\t\t\t\t\t\tEnd Date: \t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t \t\t\t\t\t \t\t\t\t\t \t\t\t\t\t\t\tType: \t\t\t\t\t\t\tSIM: \t\t\t\t\t\t\tSubscriber: \t\t\t\t\t \t\t\t\t\t \t\t\t\t\t \t\t\t\t\t\t \t\t\t\t\t \t\t\t\t \t\t\t\t \t\t\t\t\t \t\t\t\t\t\t \t\t\t\t\t \t\t\t\t \t\t\t\t \t\t\t\t\t \t\t\t\t\t\t \t\t\t\t\t \t\t\t\t \t\t\t \t
VIEWS ON THIS POST

54

Posted on:

Friday 28th December 2012
View Replies!

Problem with validating a simple form! - JavaScript Help

I'm very new to JS and trying to learn. Currently I'm trying to make a form validation for my website. What happends in the code below is that when you select an option from a drop down select field, it creates a new list item inside a ul list. I got everything to work except one thing. How many list items you can create. I simply want to restrict the user from selecting more than 3 options from the drop down menu. If you select a 4th option an alert message should pop up but I can't get it to work..Here's the JS code:function selectGenres(select){ var option = select.options[select.selectedIndex]; var ul = select.parentNode.getElementsByTagName('ul')[0]; var choices = ul.getElementsByTagName('input'); for (var i = 0; i < choices.length; i++) if (choices[i].value == option.value) { alert("The genre is already selected!"); return false; } else if (option == 3) { alert("You can only select 3 genres!"); return false; } var li = document.createElement('li'); var input = document.createElement('input'); var text = document.createTextNode(option.firstChild.data); input.type = 'hidden'; input.name = 'ingredients[]'; input.value = option.value; li.appendChild(input); li.appendChild(text); li.setAttribute('onclick', 'this.parentNode.removeChild(this);'); ul.appendChild(li); }And here is the form to validate: Genre... Animation Action Adventure Animals Comedy ...
VIEWS ON THIS POST

55

Posted on:

Friday 28th December 2012
View Replies!

importing js inside a js file - JavaScript Help

hey im wondering who to import a js file insdie another js file...for instance if i wanted to load function function from the library into a js file to execute them...if someone has any good ways/ideas/tips please
VIEWS ON THIS POST

54

Posted on:

Friday 28th December 2012
View Replies!

simple jquery conditional response-to-comment form display - JavaScript Help

I am looking to compare the data-commentid attribute process in javascript after user slideToglle function. I want to compare that value attribute in each interaction with $id variable within the php. if $id = commentid data attribute in the span tag then display the response. I am not sure whether to do the comparison in php or javascript. an example or idea is if(after slideToggle, write a response, submit the form with the response then compare $id == $idc) that would be the sequence. if $id == $idc then display the response and only then.Any idea code I have so far is as below. ' . $ufirstname . ' • ' . $message_date . ' hi how you doing today id=101
VIEWS ON THIS POST

161

Posted on:

Friday 28th December 2012
View Replies!

won't stop executing - JavaScript Help

ive got this code: $(document).ready(function() { var number = 5; function countdown() { setTimeout(countdown, 1000); $('#box').html("Selecting person in " + number + " seconds"); number --; if (number
VIEWS ON THIS POST

141

Posted on:

Friday 28th December 2012
View Replies!

In form need to add a checkbox with javascript to enctype="multipart/form-data" - JavaScript Help

I hope I am in the right forum because my php code is on another page. Because my form has to uplaod pictures it is set to method post., and enctype="multipart/form-data". Now my checkbox button does not work inside this form because it is set to method get I really would like this checkbox because I would like to ensure that people have read my terms and conditions. Can anyone help find a solutionHere is the code. As you can see at the bottom there is two submit buttons. I only want one to add the files to my directory and also to be attached to the terms agreement. Photo: Please add photo here. Other Member Information: Please Enter any other Bands the Member has been in. Other Bands: By submitting, I agree that all info blah blah booby d was done accurately & truthfully. I accept:
VIEWS ON THIS POST

86

Posted on:

Friday 28th December 2012
View Replies!

Loop problem - JavaScript Help

I have two form n i wish to move the record from first form to another formvar lengthx=document.form4.elements.length;var length=document.form3.elements.length; var choosex=""; for(var x=0;x
VIEWS ON THIS POST

86

Posted on:

Tuesday 1st January 2013
View Replies!

tinyMce and datepicker problem - JavaScript Help

I'm using JQuery datepicker and it is succesully returning but I'm also using tinyMCE in the same form when the calender appears tinyMCe is disappearing.Here is my code $(function() { // Shorthand for $(document).ready(function() { $('select').change(function() { $.post('option.php', {data: $(this).val()}, function(data) { $('div').addClass('datepicker').html(data); // $( "#datepicker" ).datepicker(); // $( "#datepicker" ).datepicker.formatDate({dateFormat: 'yy-mm-dd'}); // $( "#taskTime").val() = $('#datepicker').datepicker({ dateFormat: 'yy-mm-dd', inline: true, //minDate: new Date(2010, 1 - 1, 1), //maxDate:new Date(2010, 12 - 1, 31), altField: '#datepicker_value', onselect: function(){ var day1 = $("#datepicker").datepicker('getDate').getDate(); var month1 = $("#datepicker").datepicker('getDate').getMonth() + 1; var year1 = $("#datepicker").datepicker('getDate').getFullYear(); var fullDate = year1 + "-" + month1 + "-" + day1; $('input[name=taskTime]').val(fullDate); } }); }); }); /* $(function() { $( "#datepicker" ).datepicker(); });*/ }); tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", //theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", //theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) //content_css : "css/content.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "lists/template_list.js", external_link_list_url : "lists/link_list.js", external_image_list_url : "lists/image_list.js", media_external_list_url : "lists/media_list.js", // Style formats style_formats : [ {title : 'Bold text', inline : 'b'}, {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}}, {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}}, {title : 'Example 1', inline : 'span', classes : 'example1'}, {title : 'Example 2', inline : 'span', classes : 'example2'}, {title : 'Table styles'}, {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'} ], // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" } }); Here is my form Subject: Assigned To: Task: Select Task Controlled With Notification Periodically Simple On selecting the first and second option calender input is showing datepicker. Here is the php code
VIEWS ON THIS POST

62

Posted on:

Tuesday 1st January 2013
View Replies!