Facing problem in jquery contextmenu plugin


I'm using jquery context menu to create rows and columns on right click. For that when i click on the child div present in row its taking the parent div id and appending the rows and columns to parent div. how can i restrict parent div id to get only child id. here i'm using unique id's for every div...
Posted On: Wednesday 21st of November 2012 03:46:14 AM Total Views:  260
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




'Depth First Search' Maze Generating problem

, I'm having a problem with a Javascript maze generator. When I run it works, however the mazes being generated are not perfect as the depth first search algorithm should be, all the spaces are filled however you cant get into to some of the places within the maze meaning it is not perfect. I'm using Raphael to draw my SVG, I have attached a zip file of the files needed to run. Thank you in advance! Here is the code: //A javascript depth-first search algorithm function mazeGenerator(rows,coloumns) { function init() { //Sets up varibles this.cellSize = [5,5]; this.current = [0,0] this.cells = Array() this.cells[current] = false; this.traceback = Array(current); this.count = 0 //used to tell when all cells have been visted this.running = true } function makeGrid() { //creats the grid of cells for (var row=0;row
VIEWS ON THIS POST

97

Posted on:

Wednesday 21st November 2012
View Replies!

Multiple radio button validation problem, need help!

Hi guyz, I've got problem in this radio button validation. here's my code : function isRadioButtonselected(radioGrpName, errorMsg){ var radios = document.getElementsByName(radioGrpName); var i; for (i=0; i
VIEWS ON THIS POST

227

Posted on:

Wednesday 21st November 2012
View Replies!

Changing toggle image problem..

ToggleTip = function() { var el = $('Tip'); if ( el.style.display != 'none' ) { el.style.display = 'none'; $('ToggleImg').src = 'Images/mo1.gif'; } else { el.style.display = 'block'; $('ToggleImg').src = 'Images/mo2.gif'; } } That code is fine! But, it work work unless it's like so, or, the only way I can get it to work. Admin.ToggleTip = function() { var el = $('Tip'); if ( el.style.display != 'none' ) { el.style.display = 'none'; $('ToggleImg').src = 'Images/mo1.gif'; } else { el.style.display = 'block'; $('ToggleImg').src = 'Images/mo2.gif'; } alert($('Tip').src); } Then it works.. And I can't understand why! I've tried making the script do other functions after insted of alert. Admin.ToggleTip = function() { var el = $('Tip'); if ( el.style.display != 'none' ) { el.style.display = 'none'; $('ToggleImg').src = 'Images/mo1.gif'; } else { el.style.display = 'block'; $('ToggleImg').src = 'Images/mo2.gif'; } for (var i = 0; i < document.images.length; i++) { //Will this work! } } But still doesn't work
VIEWS ON THIS POST

125

Posted on:

Wednesday 21st November 2012
View Replies!

Image effect transition problem

Hi I've been working on a slideshow where the user could apply image effects to the slide(s) while the slideshow running. Now the problem is when I apply effect to the image it works but when the loops starts again the image effect show on previous image. I do understand I can't describe the question properly, for exact detail of my question pls have a look at the detail. Slideshow link
VIEWS ON THIS POST

243

Posted on:

Wednesday 21st November 2012
View Replies!

Sum from 1 to n problem

Howiyas, I am trying to make a javascript for a html file that will ask the user to enter a number and then find the sum from 1 to n. This is what I have done, but it doesn't return any value. Any help Javascript var input; function addInts(total,input) { int sum = 0; for (int i = 1; i
VIEWS ON THIS POST

87

Posted on:

Wednesday 21st November 2012
View Replies!

Javascript & php code problem

Could any one help me in getting this script function. it should open a new window and fetch the specific file id from mysql. it is almost like the bbc's website.
VIEWS ON THIS POST

108

Posted on:

Wednesday 21st November 2012
View Replies!

Dynamicly creating buttons problem to see them

I dynamicly created buttuns in a table, but I can't see them. Instead I see --> [object HTMLButtonElement] I know I have to use appendChild, but somehow it doesn't work. Kan someone tell me what I'm doing wrong Code htm-file: Rekenmachine Code javascript-file: function createKnoppen(tabel) { var knoppen = new Array(); knoppen[0] = new Array("7", "8", "9", "+"); knoppen[1] = new Array("4", "5", "6", "-"); knoppen[2] = new Array("1", "2", "3", "*"); knoppen[3] = new Array(".", "0", "=", "/"); var tbl = document.getElementById(tabel); tbl.border = 0; //var txt = document.createElement("text"); //var temp1 = getElementById(tabel) //txt.appendChild(temp1); for(var i=0; i
VIEWS ON THIS POST

149

Posted on:

Wednesday 21st November 2012
View Replies!

Various javascript problems

, I started work on a site for university but things seem to be going wrong so I have a few questions. First of all here are the links to all of the relevant pages for the full code: Index.html Stylesheet Javascript functions Problems in Mozilla: Both of these functions do not work correctly: // function to darken navigation options - hopefully when this bit is working the buttons will fade darker onmouseover function darkenNav(evt) { var evt = (evt) evt: ((window.event) window.event: null); var objectID = (evt.target) evt.target.id : ((evt.srcElement) evt.srcElement.id : null); if (objectID){ var object = document.getElementById(objectID); if (navigator.appName.indexOf("Microsoft")!= -1 &&parseInt(navigator.appVersion)>=4){ // then IE object.style.filters.alpha.opacity = 0.90; alert('Browser is IE'); } else { object.style.opacity = 0.90; } } } // function to lighten navigation - hopefully when this bit is working the buttons will fade lighter onmouseout function lightenNav(evt) { var evt = (evt) evt: ((window.event) window.event: null); // get objectID that triggered event var objectID = (evt.target) evt.target.id : ((evt.srcElement) evt.srcElement.id : null); if (objectID){ var object = document.getElementById(objectID); if (navigator.appName.indexOf("Microsoft")!= -1 &&parseInt(navigator.appVersion)>=4){ // then IE object.style.filters.alpha.opacity= 0.70; alert('Browser is IE'); } else { object.style.opacity= 0.70; } } } The idea is both functions will either lighten the navigation or darken when the mouse move over and off each (soon to be) link. The functions in both IE and Mozzilla receives the object correctly and will change the opacity - BUT - only for a split second in Mozilla. If you move the mouse over it flashes darker but then goes back to normal without waiting for the mouseout event. Why is this\t I want it to stay dark until the mouseout event. It also seems to flash dark onmouseout! Now in IE there are more problems: IE problems 1: The functions above don't get as far in IE 7 (haven't tried it in older versions). It does nothing onmouseover or out but tells me in the error details that 'style.filter.alpha' is null or not an object However those functions defiantly receive the object that caused the event correctly. What is wrong 2: (not CSS) The lines that change the password box (top right of page- input box) from displaying password as a default value and that should change it into password as the type (as opposed to the orginal text so that you could read password) produce an error: 'Could not get the type property, no supported' - any way of getting around this or is it just a no go in IE The function that doesn't work in IE but does in Mozilla: // function to change password input box from text (so it can display "password" to password type function change2password(obj){ if (obj.type != 'password') obj.type = 'password'; } 3. ** EDIT ** Number 3 has been solved! Hope I can get some of these problems fixed here and if you got this far, thanks for reading. Many thanks, Ed This post has been edited by eddieboy665: 19 July 2007 - 03:26 PM
VIEWS ON THIS POST

129

Posted on:

Wednesday 21st November 2012
View Replies!

Java script checkbox problem not storing in variable

I was wondering if someone could help me on a problem I have been having. In my code my function is supposed to take the elements of the form and it checks to see if it is checked or not. After that it would store it in the variable checkbox. However when I test it out it will not store it in the variable. For example if I picked sleep/ standby checkbox and hit submit it will show as 06 instead of just 6. Don't know what I am doing wrong. Here is my code. test2 function calculate(form) { var checkbox =0; var radioResults = 0; var Hours = document.getElementById("#ofhours").value; for (var i = 0; i < form.elements.length; i++ ) { if (form.elements[i].type == 'checkbox') { if (form.elements[i].checked == true) { checkbox += form.elements[i].value; } } if (form.elements[i].type == 'radio') { if (form.elements[i].checked == true) { radioResults =+ form.elements[i].value + ' '; } } if(form.elements[i].type== 'text') { radioResults+=form.elements[i].value; } } var total = ((checkbox*Hours)/1000)*radioResults; //This will show the checkboxes that are checked document.getElementById("cbResults").innerHTML = checkbox; //this will show the radio buttons checked document.getElementById("radioResults").innerHTML = radioResults; //this will show the total of the formula document.getElementById("total").innerHTML = total; }//end calculate Computer Desktop Computer 60 watts On screen saver 60 watts Sleep / standby 6 watts Laptop 15 watts Number of hours used Tacoma Power Puget Sound Energy Below show the values of the variables: For testing purposes: This post has been edited by Dormilich: 09 December 2010 - 01:49 AM Reason for edit:: removed boldness
VIEWS ON THIS POST

140

Posted on:

Wednesday 21st November 2012
View Replies!

Odd .js problem

So I have a .js file that changes a div on my html file. When I update the .js file it seems to run the program in the updated form, the problem is that when it changes the innerHTML of the div it is changing it to an old setup. The way I know it is running my new program is the variables have adjusted to the new programming, they are just showing up in what is a very old layout. I have restarted my computer. Deleted the cache in two different ways. I even disabled the cache for a little. I even tried running it on IE, same problem. If you have any questions or need some clarification please post. As it is I can not proceed, so I will watch posts pretty frequently for a while.
VIEWS ON THIS POST

143

Posted on:

Wednesday 21st November 2012
View Replies!

html problem

Good day! I created a webpage and it consists of Username,Department, and submit button, where the username is textbox and the department is a select option. I want that the cursor is set on the username and once i input my username and i press the enter i automatically setfocus on the select option without using mouse. and when i'm done in choosing my department and i press the enter i link to the department webpage where i belong. Here is my code: Untitled Document Choose your Department. . . . . .
VIEWS ON THIS POST

123

Posted on:

Wednesday 21st November 2012
View Replies!

Changing BG Color ? and also loop problem

Q1.How can i make my background and font color the same after showing the result. Q2. How come the loop stops, after two inputs here is my code: function show_prompt() { for(i=0, sum=0, odds=0; i
VIEWS ON THIS POST

99

Posted on:

Wednesday 21st November 2012
View Replies!

Sortable with scriptaculous problems

hello, Im following a few tutorials to sort a list, but i can't get the DB to update. The drag drop side of things is working, also, i javascript alert() the serialize list onUpdate and the order is printed out as follows: images_list[]=20&images_list[]=19 etc... So the sorting and dragging is working fine, i just cant get the database to update, this is my code. Sortable.create("images_list", { onUpdate: function() { new Ajax.Request("processor.php", { method: "post", parameters: { data: Sortable.serialize("images_list") } }); } }); processor.php code: //Connect to DB require_once('connect.php'); parse_str($_POST['data']); for ($i = 0; $i < count($images_list); $i++) { $id = $images_list[$i]; mysql_query("UPDATE `images` SET `ranking` = '$i' WHERE `id` = '$id'"); } Any ideas would be great, thankyou! This post has been edited by JackOfTrades: 17 June 2010 - 04:27 AM Reason for edit:: Added code tags
VIEWS ON THIS POST

172

Posted on:

Wednesday 21st November 2012
View Replies!

IE8 related problem

whenever i go on submit the form with javascript function in IE-8 browser, it opens up a new window, what could be the possible reason for this
VIEWS ON THIS POST

156

Posted on:

Wednesday 21st November 2012
View Replies!

javascript problem

function value(){ var input = /^[0-31][1-31]{2}-[0-12][1-12]{2}-[0-9][1-9]{4}+$/; var user = document.form.string.value; if(input.test(user)){ alert("valid"); else alert("invalid"); } Date Here something is wrong with my codes and i dont know what it is. the alert is now showing up if i input something im trying out a simple javascript inputing a DD-MM-YYYY formate date and it will restrict 31+++ numbers of days since theres no 32 or 33 same goes to numbers of months.
VIEWS ON THIS POST

121

Posted on:

Wednesday 21st November 2012
View Replies!

Simple Javascript eventdriven problem.

Quick question here and relatively simple for you Javascript experts. I wrote this piece of code. it basically does is alerts you which cell you clicked on. This works fine. for ( i=1; i
VIEWS ON THIS POST

112

Posted on:

Wednesday 21st November 2012
View Replies!

Javascript Display problem.

I'm trying to make it so when you click on a link, the shown DIV changes. Here's what I've got so far. Untitled Document function OpenNewWindow(windowid) { var x; var Tabs=new Array('TextOptions','BackgroundOptions','ImageOptions'); for(x in Tabs) { window.getElementById(myCarsp[x]).style.display = 'none'; } window.getElementById(windowid).style.display = 'block'; } Text Options Background Options Image Options BLAAARG1 BLAAARG Text Size: 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Text Colour: Red Blue Yellow Green Gray       It doesn't change the DIV at the top to the TextOptions on. Any ideas why
VIEWS ON THIS POST

268

Posted on:

Wednesday 21st November 2012
View Replies!

onMouseOut problem

I am reworking a page for someone. It is for a web site that sells eco friendly computers and the page I'm re-working is a display of accessories one can also purchase with the computer (e.g. wireless keyboard and mouse, larger monitor, etc.). Each image of the default accessory appears on the left with a number of buttons lined up to the right giving various options. I have set it up so that when the option button is passed over with the mouse, the image of that option appears to the left. For example, the options (buttons) for keyboard are "None", "Standard" or "Wireless". When the page loads all defaults are selected - in this case "None" is selected and the image to the left is of a standard key board. When one mouses over "Standard" the same default standard keyboard image is still displayed. When one mouses over "Wireless" the wireless keyboard image appears, but onmouseout the standard keyboard image returns, unless one selects the "Wireless" at which point the wireless keyboard image becomes the default, which means when one mouses over the "Standard" button the standard image appears, but onmouseout the wireless image returns. Hopefully you're with me up to this point. The above functionality I have gotten working just fine. However, when I create the same functionality for the next accessory, the monitor, it breaks the code. There are 5 selections for the monitor, "None" and 4 monitor choices. What doesn't work is the onmouseout functionality of having the left monitor image return to the image of the selected button. I can get the image of each monitor choice to show up on mouse over of each button, but I cannot get it to default to the selected choice. In fact the function I wrote (which is basically a duplicate function of the keyboard display with image names different) kills all functionality so it seems to me I'm omitting (or adding in) some basic error in the function. I'll display the code below. It's a bit rough, partly because I'm somewhat new and partly because I'm adding into other code, but everything up to now has worked. I need is some help in determining what I am doing wrong with the second function that makes it not work. The following code is for the mouse out function for the keyboard accessory. This function works: function outMouse(){ if (document.none.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/none_selected.gif") document.mswls.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/mouse_standard.jpg"; if (document.basic.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/basic_select.gif") document.mswls.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/mouse_standard.jpg"; if (document.wireless.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/wireless_down.gif") document.mswls.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/mouse_wireless.jpg"; } The following code if for the mouse out function for the monitor accessory. This function breaks the code of the page: function outMouseMon(){ if (document.none_mk.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/none_selected.gif") document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_19.jpg"; if (document.19viewsonic.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/19_down.gif") document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_19.jpg"; if (document.22viewsonic.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/22_down.gif") document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_22.jpg"; if (document.22VXeco.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/22_VXeco_down.gif") document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_22vx.jpg"; if (document.24VXeco.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/24_VXeco_down.gif") document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_24vx.jpg"; } Actually, if I write the second function with only the first "if" statement, it doesn't break the code, so I've been suspecting the second if statement is off, but for the life of me I cannot find anything off about it. Any help in spotting what I may have done wrong would be greatly appreciated. I am also suspecting, because I don't have a huge knowledge of javascript that there's some aspect of the DOM or something I'm throwing off with the second function.
VIEWS ON THIS POST

167

Posted on:

Wednesday 21st November 2012
View Replies!

date field problem

i have following code for date /** * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) */ // Declaring valid date character, minimum year and maximum year var dtCh= "/"; var minYear=1900; var maxYear=2100; var EDate = (Date()); var endDate = Date.parse(EDate); endDate = endDate - 86400000 function isInteger(s){ var i; for (i = 0; i < s.length; i++){ // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) 29 : 28 ); } function DaysArray(n) { for (var i = 1; i 1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i 1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ alert("The date format should be : mm/dd/yyyy") return false } if (strMonth.length daysInMonth[month]){ alert("Please enter a valid day") return false } if (strYear.length != 4 || year==0 || yearmaxYear){ alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear) return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ alert("Please enter a valid date") return false } return true } function ValidateForm(){ var dt=document.frmSample.txtDate var SDate = frmSample.txtDate.value; var FormDate = Date.parse(SDate); if (isDate(dt.value)==false){ dt.focus() return false } if(FormDate < endDate ) { alert("Please ensure that the Entered Date is greater than or equal to the Todays Date."); frmSample.txtDate.focus(); return false; } return true } Enter a Date (mm/dd/yyyy) : i want to use that code in my asp file. but i dont know where i put that code. can any body tell me where i put that code. the code of my asp file is as fallows Edit News Untitled Page News Title * Only Alphabets News Date News Expire Date News Text Active reload i need urgent help. please help me. thanx in advance
VIEWS ON THIS POST

266

Posted on:

Wednesday 21st November 2012
View Replies!

Image problems

I have a Script and it shakes the page i want to mke it so that when i have my shake() function run there is a pic of a rollercoaster (to show and copy the real thing) so here is my code (so far) var y =Number.MAX_VALUE; function shake(n) { if (parent.moveBy) { for (i = 10; i > 0; i--) { for (j = n; j > 0; j--) { parent.moveBy(-i,0); parent.moveBy(0,-i); parent.moveBy(-i,0); parent.moveBy(0,i); parent.moveBy(i,0); parent.moveBy(0,-i); parent.moveBy(-i,0); parent.moveBy(0,i); parent.moveBy(i,0); parent.moveBy(0,-i); parent.moveBy(-i,0); parent.moveBy(0,-i); parent.moveBy(i,0); parent.moveBy(0,i); parent.moveBy(i,0); parent.moveBy(0,i); } } } } // End --> Whats creepy is that the error message is: "Acess Denied" ps: if you take away the whole body tag and the tag it shakes but when yo want an image you get this crap > This post has been edited by kirbyfan101: 21 October 2009 - 05:17 PM
VIEWS ON THIS POST

138

Posted on:

Wednesday 21st November 2012
View Replies!