Modification Of TreeMenu Code
Jun 29, 2009
I am using the treemenu from here [url] It works great, but my clients wants to have the functionality that (if there was only two levels) that if you expand into one level and view all the sub items and then click on the another main node that it would contract all existing items and then display the new sub node?
View 2 Replies
ADVERTISEMENT
Jul 23, 2005
My web page has one unordered list that disappears in Firefox. The
unordered list in question has the class="dir". I double-checked the
source code and verified the markup's semantics. Everything looked
fine. So I placed the code in the W3C validator and it passed with no
errors. Then I placed a regular unordered list with no class before
the previous unordered list. Upon a reload, the new unordered list did
not render, yet the unordered list with the "dir" class appeared. The
whole situation was strange.
After reviewing web page with the DOM inspector, the disappearing list
had been assigned {display: none}. Apparently, my JavaScript for
TreeMenu functionality was the culprit. I attempted to debug the
JavaScript. Sadly, my JavaScript knowledge is elementary even though I
successfully implemented the approach from
http://www.bakketun.net/listmenu/. When my web page became more
convoluted, the JavaScript began faltering along its seams.
Here are my discoveries while debugging (using Venkman). The
elementHasClass() should match the "element.ClassName" with
"TreeMenu." If not, the function return false. Unfortunately, another
function passes the div element to the setMenu(); then the said
function assign the display attribute; block or none.
But I can not pinpoint where the code goes down the wrong path;
needless to say develop a solution.
Please review the site below and let me know if you have suggestions.
View source and search for class="dir"; the disappearing list has the
text "test." Problematic code JavaScript area may include the line
listed below. This posting was intended as a short description.
Further clarification will be gladly provided if someone shows
interest in a particular aspect. I have pages of notes on the
debugging process.....
View 1 Replies
View Related
Jun 24, 2010
get my menu to drop down when people click on the head-menu alternatives "text".
For an example
* Example 1
* Example 2
* Example 3
I dont want the dynamic drop down effect to activate when u click on the "*" <-- star sign, instead Id love to make the "Example 1" clickable as Hitarea for the dynamic drop down effect to apply...
I will send the code for both CSS in which the "hitarea" is explained as well as the HTML treemenu code :)
HTML Treemenu code:
<html>
<head><title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
[Code].....
View 3 Replies
View Related
Jun 4, 2009
How can I change the behavior of the alarm clock script from Javascript Kit located here [url] to make it so that it displays a simple alert message instead of following a link?
View 3 Replies
View Related
Nov 12, 2010
I'm justing wondering about the behavior of JS in regards to adding elements, suppose I have something like this:
I'm just wondering at the point I hit that "// DO SOMETHING WITH ONE OF THESE DIVS", are all the divs I have added in the DOM available to access?
I ask because I have some code at work in which a tester is reporting an error that happens which I can't reproduce, and they and others have had it a few times.
The only way I can explain it in my mind is if the div is not available to me at the time of execution. So I'm just looking to rule it out or confirm my hunch.
Is document.getElementById("myDiv").appendChild(obj); synchronous and the next line of code wont execute until the DOM is ready or is it in fact a asynchronous call and therefore adding alot of elements to the DOM could result in a lag so some divs or not available straight away.
View 1 Replies
View Related
Jul 14, 2010
I needed to calculate my prices on-the-fly and display it in textbox with javascript. Well I did succeed with values of radio button an checbox, but as I know very little javascript, I don't know how to expand the code I got from here: [URL].
How can I make this happen: I have a textbox:
HTML Code:
<input type="text" name="podstranice" size="19" class="podstr" onkeyup="this.form.total.value=calculateTotal(this);">
And when a user inputs a number in it, javascript multiplies it with some other number, say 10 (its a price*quantity thing) and adds it to the total price along with data from checkboxes and radio buttons. And so, this is my javascript. It is basically identical to one on the link, but you can view it better this way I think.
Code:
// Calculate the total for items in the form which are selected.
function calculateTotal(inputItem) {
with (inputItem.form) {
// Process each of the different input types in the form.
if (inputItem.type == "radio") {
// Process radio buttons .....
View 1 Replies
View Related
Feb 26, 2011
How to create a function that would allow me to add to or subtract from a maxvalue, and thankfully I got help regarding that. However, something's got me stumped for the past few weeks that I still can't resolve...
This is the relevant code:
As it stands, it works as long as the total value is less than or equal to the limit (for advantages it's 15, for disadvantages it's 10). However, the moment it goes past the limit -- for instance, if you change Antisocial's value from 2 to 7, or if you add several additional checkboxes with any values -- the whole thing starts going crazy; specifically, maxvalue doesn't revert to 40 when the all the checkboxes are unchecked.
What I'd want to happen is that the user cannot select or apply advantages or disadvantages if the maximum advantage is greater than 15 or the maximum disadvantages is greater than 10.
I'm thinking that a button for adding disadvantage points to/subtracting advantage points from the maxvalue (that becomes disabled if the user goes past his limit on advantages/disadvantages) is useful at this point, but I'm really stumped on the implementation of the idea. An alternate idea of mine is that all other advantage/disadvantage checkboxes would become disabled if their value is greater than the remaining number of points, but I don't know how that is possible either.
View 2 Replies
View Related
Feb 8, 2010
I have been looking into the following lightweight image gallery:[URL]... It does everything I want except for displaying thumbnail images (it crops the original images). Some dude has posted details as to how this may be done, but I am baffled as to why it will not work. Here is the javascript:
[Code]...
View 2 Replies
View Related
Jun 21, 2011
I'm adding title attribute to some elements by using mouseenter function. But I would like to hide the shadow which comes by default nehind the tooltip frame and wrap the text in 2 lines!
[Code]...
View 1 Replies
View Related
Feb 4, 2010
[URL]. I looked at this script and I tried playing around with it but could not figure out how to: Instead of having a check box field and then a radio box field, have 2 radio box fields, so the user picks from one group of radio boxes and then another. Then change the math behind it so the values in the first field are multiplied by 100 and then the values in the second field tack on a percentage (ex value in first field is 1.5 so 1.5x100 = 150 and value in second field is .5 so total is 225).
View 1 Replies
View Related
Mar 14, 2011
I use the following code to add a "click" behaviour to an element:
$(document).ready(function(){
$("#element_id").click (function(){
...... do something ....
[Code]....
Part of the node I clone is the element from the first piece of code I quoted. The addRowJob function also changed the ID of every element in the node I cloned. This way all IDs remain unique. Lets say the element in question has the ID "#element_id". Now I clone the node (which includes the element) and the cloned element gets its ID changed to "#element_id_new".
Of course I now want this newly append element ("#element_id_new") to have a click event attached to, but even if extend my $(document).ready(function() to:
$(document).ready(function(){
$("#element_id").click (function(){
...... do something ....
});
[Code].....
I simply doesn't work for the appended element.
My guess is that the $(document).ready(function(){ only fires when the document is finished loading. At this stage there is no element with the ID "#element_id_new" and therefore the click event can't be attached to the element. Makes senses...
But how do I get this click event attached to the newly appended element with the ID "#element_id_new"?
View 2 Replies
View Related
Sep 24, 2011
I have been successfully using the following "myAjax" function to load text file information from the server.
ajax.js:
After I load the text file, I store the text "records" into an array by doing something like this:
Where the '}' character is my record delimiter. It could just as easily be ' ' or ' ' or the like.
Again, I am not having any problems doing it this way as it suits my current needs.
Now the question(s)
1. Does the call to read the text data from the external file always read in the entire contents or can I read one line or delimited record at a time and store it to the array directly without the text storage?
2. If the text is always read completely (my suspicion), can I safely delete the "TextInformation" after I convert to the array format? Is there any memory penalty for doing it this way as the text information can be somewhat lengthly and I don't like the idea of having doubled memory usage when I only need the information in array format anyway?
This is the idea I am considering, but I don't know if there are drawback to this method of if there is a better way to accomplish the task.
ajax.js:
View 18 Replies
View Related
Jan 16, 2011
I have a webpage with a form inside it. Below the form is a div. When you submit the form it executes some javascript that adds a bunch of html to the div. I can step through the code in the Chrome debugger and see my dom changes are there, but disappear as I get to the original tags in the page. Is there anyway to prevent this?
[Code]....
View 4 Replies
View Related
May 21, 2011
here is the page I'm working onhere is the jQuery in use
$(document).ready(function() { $('.error,.success').hide(); $("#send").click(function (){ $('.error,.success').hide("slow"); $.ajax({ url: 'add.php?lnk='+$.URLEncode($('[name=lnk]').val())+'&
[code]....
and in this code, it works, the call is made and text is added. in the other code I don't get a change at all. Not even in the database that add.php manipulates.
View 2 Replies
View Related
Mar 23, 2011
I am trying to make a gui for clients to edit a php page that displays html and javascript.
I want the user to be able to move html elements around and even edit it like add effects like fade in and out etc.
Then after all the changes I want to overwrite the existing php file that does this for that user. how can you make such changes and then save it to a file?
It's an html / javascript editor but using a gui instead of allowing them to directly touch the code. It would be a security risk if I allow such a thing. So I need to program a interface that would make such changes and save them to file.
Like how can you delete and add new javascript code to the file?
View 3 Replies
View Related
Dec 17, 2007
I am a novice, almost to an intermediate-level JavaScript guy, so much of this is new to me. I appreciate your patience reading this.
I have a routine that creates some HTML on the fly (updateFilters() function) and after the HTML is created, I attempt to access some fields (elements) on the form itself.
I works fine if I place an alert() statement after the HTML is created, but when I remove, the code errors out.
I have tried the setTimeout() statement, but I cannot grab the element --- undefined or null is returned. It seems that the form is the only element I can get a handle on --- everything else is undefined or null...
Here is the code:
function editQuery() {
var f;
var x;
var myForm = document.forms[0];
// Get the row filters that were used in the last query..
for (f = 1; f < 16; f++) {
var filter = eval("myForm.FilterList_" + f);
if (filter.selectedIndex > 0) {
var methodElement = element("FilterMethod_" + f);
var methodIndex = methodElement.selectedIndex;
var savedFilterMethodValue = methodElement.options[methodIndex].text;
var choicesElement = element("FilterChoices_" + f);
var choicesIndex = choicesElement.selectedIndex;
if (isNaN(choicesIndex)) {
var savedFitlerValues = choicesElement.value;
}
else {
var savedFitlerValues = choicesElement.options[choicesIndex].text;
}
updateFilters(filter); // update the filters
// take the saved methods and values and then update the selections
// Alert here makes the code work..
// alert("Try this");
// Wait for HTML..
setTimeout("completeEdit()", 1000);
function completeEdit() {
// Since the object was updated, get the object again..
var methodElement = element("FilterMethod_" + f);
for (x = 0; x < methodElement.options.length; x++) {
if (methodElement.options[x].text == savedFilterMethodValue) {
methodElement.options[x].selected = true;
break;
}
else {
methodElement.options[x].selected = false;
}
}
// Since the object was updated, get the object again..
var choicesElement = element("FilterChoices_" + f);
for (x = 0; x < choicesElement.options.length; x++) {
if (choicesElement.options[x].text == savedFitlerValues) {
choicesElement.options[x].selected = true;
break;
}
else {
choicesElement.options[x].selected = false;
}
}
// Only display next row if f = 2..
// If only one row was used, no reason display the next row..
if (f == 2) {
displayNextFilter(f - 1); // display it
}
}
clearTimeout(timeOut);
}
}
}
Do I have to pass the object (the form, the elements) to the completeEdit() function in the setTimeout() statement?
View 5 Replies
View Related
Jan 6, 2011
I am trying to hide this code:
HTML Code:
using this code
HTML Code:
This works fine when I place this code under the html in the main source, but if I try to add this Jquery code to an external js sheet it doesnt seem to work?
Currently my js sheet is called in the header, when I move this link to the footer of my page the code works again, so Im guessing this has something to do with where the jquery code is placed in relation to the code Im trying to hide?
How I can keep my js in the header but still make the content disappear on click?
View 2 Replies
View Related
Jan 1, 2010
I'm trying to get my Client Side Firefox DHTML app to display a list of eBooks. For this, i have the following files
F:Textbooks.html
F:eBooks.txt
F:FirstBook.txt
F:SecondBook.txt
F:ThirdBook.txt
[Code].....
i'm using FireFox 3.5 to develop this App. So obviously this will not work with anything other than Gecko Based browsers.
here is my HTML code:
<html>
<head>
<script language="JavaScript">
var eBookLibrary = "eBooks.txt";
[Code]....
View 2 Replies
View Related
Jun 30, 2010
I am VERY NEW to javascript programming as I am to web development. I am pretty decent with VB.Net though. My question is, what are the different ways to call a JavaScript Function either from within XHTML Markup code or from a VB.Net Code-Behind file?
View 3 Replies
View Related
Aug 26, 2010
The code executes nicely in the site and the pictures/text show up where and how they should - It's just that I'm also getting some code as a slide!
In the <head> I have:
<script type="text/javascript">
$.fn.cycle.defaults.timeout = 8000;
$(function() {
$('#contentLeft pre code').each(function() {
[Code].....
View 1 Replies
View Related
Oct 25, 2011
I can not this code in my web page. Could you please check it ans say how I can run. I try the code using html test page but failed.
<script language="javascript"><!--
document.write('<iframe src="http://www.juenpetmarket.com/moduls/banner/banner_reklamiframe.aspx?
[code]....
View 13 Replies
View Related
Aug 2, 2010
After realizing that htc files only work with Internet Explorer, I have needed to have JavaScript code to suit the two lots of css code below. Please help, I need the code pretty urgently. The code must work with most versions of browsers.
[Code]...
View 1 Replies
View Related
Feb 6, 2009
how to "clean up" html code, from code that defines image (image, and nothing else). I have string like:
Code HTML4Strict: This is my <b>code</b>. <img src="img/1.jpg" /><br />This is line number two.The result shoud be:
Code HTML4Strict: This is my <b>code</b>. <br />This is line number two.
View 1 Replies
View Related
Jan 14, 2011
I hope whether such a script exists for what am wanting to do. From time to time, I need to send password information or login details and password information to some users. At the moment, am doing it via email with a subject named FYI and the body of the email basically just contain the login and the password or in some case, just the password. What am wanting to know is whether I can put these information into a HTML file which contains an obfuscated Javascript with a button that a user will click that will prompt for his login information and then will display the password. In its simplest form, I guess I am looking for a Javascript that will obfuscate a HTML file that contains the password. I found some website that offers such service as obfuscating a HTML file but am hoping it can be done via a Javascript so it is at least "portable" and I do not have to be online.
View 5 Replies
View Related
Aug 3, 2007
I am about to port an app using html, css, and javascript where most of the content is mixed with the presentation and behaviour.
The question I have been asked is: even though this older style is difficult to maintain, will the method proposed my the authors of Simply Javascript perform adequately on a page with hundreds of entries like the one below? Using the newer method, the program would have to iterate through all the elements on the page and assign handlers for click, mouseover, etc. Please advise. Code:
View 3 Replies
View Related
Nov 24, 2009
I want to add few lines for content, which is already present, using Javascript.
HTML code :
<html>
<head>
<script type="text/javascript">
function test()
[Code]....
If image is grater than 300px width then below line should be appeared otherwise no.
<p><a href="image1.gif"><img href="zoom.gif" /></a></p>
With above script i reached upto half part.
View 3 Replies
View Related