I've been trying to create a function that creates objects and another function that can delete them when triggered the objects code is generated server side and triggers the function passing the object data. The object data sort of looks like this
I've tried a few methods I looked up but whenever I try to get them to work the way I need them they throw errors... It would be very cool if you could also get it under a div tag.
I have some ajax functionality I have made, this basically creates an item in a database by an add button, the items are in a li.
I have a delete button span which when pressed shows a confirm or cancel buttons which are hidden initially, If i have more than one item in the list is will show and hide them on all the items in the list, heres the code
$('.source_delete').live('click', function(){ //Fade out delete button $('.source_delete').fadeOut(); //Show confirm button
[Code]....
I need the show and hide not to apply to all items in list, the issue is im aware you cannot use live and each together, is this correct?? how can I go about doing this?
I'm trying to create a function in JavaScript using Dreamweaver8 such that when a user hits the ' F1' key when a text box is selected a separate "pop-up" window will open, with text of my choice.
Does anybody have any pointers or even some source code? I use ASP on my server.
Write a function translate() that will translate a text into "r�varspr�ket". That is, double every consonant and place an occurrence of "o" in between.
I came across Marijn's helper function again called forEach. It does just what it sounds like it does, and is one of those things one would consider adding to their own personal little library like getElementsByClassName...My question is, I've heard/seen that Mozilla (and only Mozilla at this point) indeed HAVE a forEach function, and I do most of my beginning testing in a recent-stable Mozilla browser, so I'm not 100% sure but I think the Mozilla forEach might work... what happens if I write my own and I keep the name?
So if there's some default forEach that the browser natively understands, and then I have a function in my lib that has the same name, does mine take precedence over the native one, or not? Is it just safer giving libraries slightly weird names so new in-built functions can't possibly interfere?So also, if later browsers end up implementing the newer Javascript (2?) that as I hear, will implement a getElementsByClassName, would this break, or ignore, everyone's pre-made getElementsByClassName, assuming they are called the same name?
I am trying to create a function that takes a users input in the form xx/xx/xxxx. Then I need to figure out a way to compare to a new date and give which day of the year it is when using: alert("This is the" +foo+ "day of the year."). Im alittle confused on how to take the users input and compare it somehow to give me the day of the year.:cool:
I have the code this way in order to consolidate it since I would prefer to do that instead of checking the selected ID and manually checking against all possible IDs (which works flawlessly, it just takes up about 5x the lines and is not modular). What I have above also works, but there is one fatal flaw:
It seems like the anonymous function that is the onclick for each unselected element becomes "return changeTo(tab + '_id')", but I don't want it to be that. I want the argument to actually be what tab is instead of the variable.
What ends up happening is that after changeTo() is called for the first time, any element you click will result in the last element being the selected one, as if it's using the final value of tab as its return value.
This doesn't make any sense, though, since tab is local, and deleting it before the function exists doesn't work. Deleting elem at the end of the for loop doesn't work. I honestly don't understand what's going on or why it doesn't set the new onclick value correctly.
Basically I just want changeTo(tab + '_id'); to turn into changeTo('MYID_id'); instead, but it simply doesn't do that and I can't figure out a way how.
I would like to store a variable then call it back later. I have a variable on line 198 www = ''+this._ad.clickUrl+''; And on line 321 I try document.write(www); I've tried so many different options, just won't work. I have even tried to call document.write(window.www);
The code is below.. might be easier to read on [URL] Code: <html><head> <title>Integrated Ad Sample</title> <!-- NOTE MANDATORY jQuery Include --> <script type="text/javascript" src="[URL]"> </script><!-- Integrated Ad Include--> <script type="text/javascript"> .....
Is it possible to create URLs from function call operators?
For example, I'm trying to program an onClick function which will load a webpage in one frame and an image in another, based on the name of the button which is being clicked. So clicking the button with name="help" will open "webpages/help_page1.html" in one frame, and "images/help.jpg" in another.
To do this I was hoping that the following would work, where the function had been called by
function activate(buttonName) { webpageURL="webpages/"+buttonName+"_page1.html" imageURL="images/"+buttonName+".jpg" parent.frame1.location.href=webpageURL parent.frame2.picture.src=imageURL }
But this doesn't work, because the browser (IE6) looks for "webpages[object]_page1.html" and "images[object].jpg".
I create an iframe in script and load it with this code.
[Code]...
This should force the loading of the savepages.php file. In that file I do an echo to verify that it is called.
[Code]...
The objective is to call that php function. The javascript function is called. I don't know if the element is actually created. Unlike php javascript doesn't put anything in the source for us to verify. I don't have ajax. How can I make the javascript function call create an element that loads the php file and causes the code in that php file to execute.
I am creating a game which will need to create arrays and store variables for thousands of different users. I have created about 15 functions that will need to store their changes to variables so that the game can progress.show me a simplistic way to store a variable altered or created in a function longterm?
I want to learn more about creating functions for element events without having to put onclick event in every tag. For example:
<script> document.getElementsByTagName('input').onclick = function () { alert('hello'); } </script>
Now, I know the above does not work as I have tried it but hopefully the idea of what I am trying to achieve here. Basically for every input tag, when the user triggers the event (click) it will do the same function.
Anyway, I would more so like to learn about this type of scripting where you assign functions to events. However, I dont know what to search for in google and the like. Where could I learn more about this?
I'm very new at this. I'm using jquery within wordpress and I've created an image slideshow with captions. It worked fine. Now I want to include a slide counter. I followed the example here as best I could: [URL]...
This is the code I have:
<script type="text/javascript"> var $j = jQuery.noConflict(); $j(document).ready(function() { $j('#ng_slideshow').cycle({
All the function extending I see extends on an _object_. I want to extend on a string. /** * Returns a slug version of a string */ jQuery.extend ({ slug: function( text ) { return text.trim().toLowerCase().replace( /[^-a-zA-Z0-9s]/g,'' ).replace( /[s]/g, '-' ); }}); I want to be able to do something like: $('#form_element').val().slug(); The above does not work. I even tried modifying the 'trim' function in jQuery core to include the rest of the enhancements, but it didn't work.
I have 3 button controls on my asp.net web page. This r html controls one of them I have set to default on form load. Using javascript how do I set the other 2 button to be clicked when it has focus & enter key is pressed.
etc.... and each one is different, related to an input field, and as you can see it is a radio input array, and all radio inputs are named add_id[1], add_id[2], add_id[3] and so on i want a javascript function that will swap all the values of these radio buttons to whatever the first on is set to, either 'yes' or 'no' Code:
I want to create a "radio" symbol on a website. When click on it, a cumulative number will be shown beside the symbol. <form> <input type="radio" value="Click me!" onclick="m=1; n=m+1; document.write(n);" /> </form>
I tried to move write function out of the form using Javascript but I couldn't get it. <script type="text/javascript"> document.write(n); </script>
<script> // Declared Constants MORSE_ALPHABET = new Array ( '.-', // A '-...', // B '-.-.', // C '-..', // D '.', // E '..-.', // F '--.', // G '....', // H '..', // I '.---', // J '-.-', // K '.-..', // L '--', // M '-.', // N '---', // O '.--.', // P '--.-', // Q '.-.', // R '...', // S '-', // T '..-', // U '...-', // V '.--', // W '-..-', // X '-.--', // Y '--..' // Z ); CHAR_CODE_A = 65; var CTS = prompt('Enter Morse code','here') var inMessage = CTS.split(' '); searchLocation(inMessage,MORSE_ALPHABET) function searchLocation(targetValue, arrayToSearchIn) { var searchIndex = 0; // Iterative counter for(i=0;i < targetValue.length;) { targetValue = targetValue[i]; // Search until found or end of array while( searchIndex<arrayToSearchIn.length && i != targetValue.length && arrayToSearchIn[searchIndex]!=targetValue) { i++searchIndex++; } if(searchIndex<arrayToSearchIn.length) { return String.fromCharCode(CHAR_CODE_A + searchIndex); } else { return -1; }}} document.writeln(searchLocation(inMessage,MORSE_ALPHABET)); </script><head></head><body></body>
This is my code and I have figured it to create an array from the prompt and then use the function to return the first array it finds but I cant seem to make it go on to the next index of the array. I know that when you return a value the function closes and I have tried to store my return in a variable but its not working the way I want it to or I'm not writing the correct command or is there away to do multiply returns, I think what I need to do is simply but I have been staring at this screen for a while now and just cant see it.
I would like to include drop-down navigation links on my home page that connect to other pages on my website. No problem there. The problem is that some of the other pages contain a series of div elements that are hidden (display:none) until activated by javascript enabled links on the page. Clicking those links changes some of the page's content (within a div) .. almost like a "new" page. [URL]. Here's my question: Is there any way to create menu links on my home page that will open the "concert.html" page AND display the appropriate div content at the same time? For example: on the home page, a menu link under "Concert" that opens that page and automatically displays the "Rock Symphonies" section?
Here are the related HTML div elements on the "concert.html" page: <div id="page1">concept content</div> <div id="page2" style="display:none;">rock symphonies content</div> <div id="page3" style="display:none;">general program content</div> <div id="page4" style="display:none;">ticket price content</div> <div id="page5" style="display:none;">concert committee content</div>
Here are the corresponding js-enabled links: <li><a href="javascript:page(1,5);" id="tag1">Concept</a></li> <li><a href="javascript:page(2,5);" id="tag2">Rock Symphonies</a></li> <li><a href="javascript:page(3,5);" id="tag3">General Program</a></li> <li><a href="javascript:page(4,5);" id="tag4">Ticket Prices</a></li> <li><a href="javascript:page(5,5);" id="tag5">Concert Committee</a></li>
And here's the javascript I'm using: (scripts/generator.js) function page(id,all) {for (i=1; i<=all; i++) { if (i==id) { document.getElementById('page'+i).style.display="inline"; document.getElementById('tag'+i).style.fontWeight="normal"; document.getElementById('tag'+i).style.color="#FFF"; } else { document.getElementById('page'+i).style.display="none"; document.getElementById('tag'+i).style.fontWeight="normal"; document.getElementById('tag'+i).style.color="#a4bfed";} }}
make my script smaller by creating a function that controlls every textboxes instead of one textbox. See below my code that I want to make it smaller...
I add items to a list of ids within a <TD> named lstCarts using the following code:
function lstCarts_ondblclick() { index = NewProgram.lstCarts.selectedIndex; if (index != -1) { vID = NewProgram.lstCarts.options[index].value; vText = NewProgram.lstCarts.options[index].text; NewProgram.lstNewCarts.options[NewProgram.lstNewCarts.length] = new Option(vText); NewProgram.lstNewCarts.options[NewProgram.lstNewCarts.length - 1].value = vID; eval("NewProgram.Item" + vID + ".value = " + vID); }}
This works fine. When I highlight an item in lstNewCarts and click on a button to delete these items from the list the following code is executed. This doesn't work becauset the selected item does not disappear from the list.
function lstNewCarts_ondblclick() { index = NewProgram.lstNewCarts.selectedIndex; if (index != -1) { vID = NewProgram.lstNewCarts.options[index].value; vText = NewProgram.lstNewCarts.options[index].text; eval("NewProgram.Item" + vID + ".value = -1"); }}
will u suggest me how to delete child from node. i have a xml file. There are four subnodes in the Contact element i have to delete subnodes value from file...