I have a page with 2 drop-down menus. The task is, when you select 1 menu, your selection then changes the options available in the other. This data happens to be drawn from a mysql database, so I wouldn't think that it could be done purely in Javascript, but rather a combination of PHP generating some JS code. Thing is, I don't even see how to change a menu's available options with JavaScript, only names and values of individual fields.
The basic concept is a music playlist that I'm trying to write as a table inside a div.
I have Song and Playlist 'classes'. The Song class has a Write() method, as does the Playlist.
The Song.Write() boils down to this: var tr = document.createElement("TR"); var td = document.createElement("TD"); tr.id = this.ID; tr.appendChild(td); td.innerText = this.Artist + ' - ' + this.Title; td.onclick = function() {top.playSong(this.parentElement.id);} return tr;
The Playlist.Write() call is essentially this: // this.songs is an Array of Song objects for (var x = 0; x < this.songs.length; x++) { playlistTable.appendChild(this.songs[x].Write()); }
When I attempt to call playlistTable.appendChild() after creating the table via document.createElement("Table"), everything works fine, except I have no way to add the table to my document, since the div I want it in won't believe that appendChild() is a valid method. If I put the table in the div as a <TABLE>, and then try to append to that, the *table* doesn't accept appendChild() as valid. Specifically, I get an 'Invalid argument' error when calling either.
I have been working on an autocomplete script that I have modified to be used with JSP's/Servlets. The script is working very nicely, except for one minor issue. When the user selects from the suggestions in the drop down list, for some unexplained reason, an extra space is added to the word in the text field. Also, I would like to modify this script further, such that if a user enters more than one word in the text field, the autocomplete script is activated for each word, instead of ONLY the first word.
I have added the entire code for the JavaScript file that is responsible for the autocomplete feature below.
The link from where you can download the autocomplete files is here:
[URL]
a demo of the script can be found here:
[URL]
FYI, I am using the version that uses XML.
Below is the JavaScript code for the autocomplete file I am using:
if(typeof(bsn)=="undefined")_b=bsn={};if(typeof(_b.Autosuggest)=="undefined")_b.Autosuggest={};else alert("Autosuggest is already set!");_b.AutoSuggest=function(b,c){if(!document.getElementById)return 0;this.fld=_b.DOM.gE(b);if(!this.fld)return
How can I modify a page before it is rendered? I tried using greasemonkey to remove a script, but it runs it anyway. Is there some way I can get rid of a script on a page before it runs.
What I originally tried to do was removeChild, but that of course is done after the page is rendered. Then I tried wrapping the script in <noscript> tags, and it still was executed.
First though JS is not my strong suit and the above code is something I found at the W3School site or whatever it is. What I would like to do if possible is add a Cancel button to the alert box that when clicked cancels the form submission it's attached to and keeps the user on the current page to modify the data they entered in to the form should they want to change it. As it stands, all there is is an Ok button and if you click the red x in the corner it acts as if you clicked ok so if a user wanted to change their form data they'd have to close the browser to start again. Aside from liking to add a cancel button I would also like to if possible change the alerts Ok button to read something different. Not sure yet, thinking either Submit or Proceed.
I’m trying to modify a DHTML editor that parses a style-sheet via PHP and instead of modifying the tags via execCommand(), find a way of writing inline styles by way of adding <span style=> tags around the selected text.
Easier said than done. My first though was to do a search and replace on the innerHTML, but falls down if there is more than one match (it will only modify the first occurrence). I suspect that even if I could find the text around the selected area, this could still fall down for same reason.
So, I’ve got the selected text via the createTextRange() method. How do I modify this text and write it back out to the textarea.
I have a form which houses basic inputs, as well as a few multiple select forms.
I need to parse all the 'values' which are in this multiple select form (it gets manipulated dynamically client side). I wanted to create a function that loops through all the form elements, and if the type 'select-multiple' is detected, gather the VALUES of each <option> inside it.
The bit I'm stuck on is then how to reconstruct this into a form submission. Preferably I wanted the data from the 'select-multiple' element to be submitted as comma delimited, eg 14,12,512,63,62 which would later be parsed by PHP.
I was considering reconstructing a query string and submitting that as GET, but I'd prefer to POST it along with the other data (such as INPUTS etc) which do not need to be changed.
Can I somehow attach some 'hidden' type data onto the end of the form submission at this point?
So I have a wordpress site I'm just quickly prototyping the design of for my 3D portfolio.I'm using an iframe to display another html page I have for my resume. I want to use jQuery to remove the css paddingYou can see the code that wordpress outputs over herePageCodeThe iframe code in specific is
sorry for the stupid question but how can i modify the href atribute of the link without having a id of the "<a>" just because it's the link of an image with an id?
I own a game site and some users cheat by changing the browser URL. For example :
The URL for starting a game mission is this : ww.somesite.com/somethingaspx?htxm=18
And if they change the number to 87 they go to the end of he mission WITHOUT actually completing it.
They ONLY way to deal with this is by preventing users from changing the URL manually. Is there a way to do it? Like, if someone tries to change that number in the URL he gets a message and browser window closed(or something that will prevent him from going to that page)
Of course, the solution must not conflict with the normal navigation(which is the actual mission) which means the user should be able to navigate to different pages but NOT change the URL manually.
All semester, I have been working on a single web page, modifying it repeatedly to add features (using CSS). This last assignment involves javascript, something we've just barely touched on. I can't seem to figure out where exactly the event handler should be placed. No matter where I move it, it alters the way the page displays. In the right column, there are descriptions of 2 musicians, each includes a header, paragraph, and a thumbnail (that links to a larger image) on the far right side, next to the text.
I need to add this <a href="#" onmouseover= "alert( 'Concerts sell out quickly so act fast!');">Melanie Morris entertains with her melodic folk style.</a> to this <h3>January</h3> <a href="melanie.jpg"><img src="melaniethumb.jpg" alt="Melanie Morris" width="100" height="97" align="right" border="0" hspace="150" /></a> <p class="content">Melanie Morris entertains<br /> with her melodic folk style.<br /> Check out the podcast!<br /> CDs are now available. </p>
The problem is, the book doesn't explain where to add it or have any examples of using onmouseover in this particular way, so I've spent forever trying to figure it out. In some places, it makes the sentence shows up twice. In others, it completely moves the picture out of position and/or extends the "Melanie Morris entertains with her melodic folk style" all the way across the page (thus, pushing the picture down). I initially had a very hard time making this page layout work (specifically, getting the images to show up in the right place).
The best I am getting from this is adding the mouseover immediately after the paragraph class and right before the Check out the podcast! line...removing from the paragraph the text that is repeated. It seems to look OK on IE, both full screen and when I make the screen smaller. Foxfire is displaying it less reliably though. As soon as I make the window smaller, the layout shifts. I know that it's normal for different browsers to display differently.
Any way to work around the rules so that it looks right, but is not, in fact, coded properly. <h3>January</h3> <a href="melanie.jpg"><img src="melaniethumb.jpg" alt="Melanie Morris" width="100" height="97" align="right" border="0" hspace="150" /></a> <p class="content"> <a href="#" onmouseover= "alert( 'Concerts sell out quickly so act fast!');">Melanie Morris entertains with her melodic folk style.</a> Check out the podcast!<br /> CDs are now available. </p>
I contacted the authors of the codes but they have not responded to me so I hope someone here can give me some answers. Below are the two menu scripts I will be referring to:[URL]... Currently, I'm using HVMenu. It's a great piece of code and I love using it. As the code exists right now, the first sub-level sits just right below the main menu bar: For my recent project, I want to be able to make the first sub-level to overlap the main menu when it's in a horizontal state.
This only works with HVMenu if it's in a vertical state. So, I looked into using Top Nav Bar III. It works perfectly! Except it doesn't allow for images in the coding. (At least, I couldn't figure out how to mod it to get an image background and rollover images like HVMenu).
Ultimately, I want to code this menu: Notice that up arrow that butts up into the main menu bar? This is why I need it to overlap. So now, does anyone have any fixes for either of the scripts I'm using OR have alternate suggestions?
I suppose than my css file has different rules for the same element depending of the media @media print #image { clip: rect(auto, 700px, 1200px, auto);} @media screen #image {clip: rect(auto, 1024px, 700px, auto);} Can I dynamically change the css data "clip" only for the @print media ?
I'm using Chrome and it's JSShell extension I remove the <emb> and some <iframe> tags from a lot of different sites because their annoying ads.
The I use code for most sites looks like this:
It doesn't do anything. If I don't use $(document).ready() it removes all the ads. Is there a way to do that before loading the document or am I doing something wrong.
I am using this script to rotate background images and it is working great HOWEVER we would like to control the order of the rotation and I am just not sure how to modify this code to do that? I have looked and tried several options but I am just missing something
I have a countdown script I'd like to modify so that the countdown ends at a specific hour, and not on a particular day at midnight. I'm new to coding (Ruby), so still trying to get the hang of Javascript:
var current="Expired" var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") function countdown(yr,m,d){ theyear=yr;themonth=m;theday=d var today=new Date()
I have been trying to learn JavaScript and most recently jQuery. After playing with some cool stuff like hiding, showing, animating etc... html elements I started wondering if when doing this you should do it thinking about how your layout and be careful not to break it since I noticed that when for instance if you hide a div it actually takes it out of the normal flow and if this div is part of the layout structure it could potentially break it.
Is it a common practice to think about the layout when using JavaScript/jQuery to play with elements or objects on a page?
Is this the first think before making any modification to any element that could affect the layout or is there something that I'm not aware of to prevent from taken these elements out of the normal flow?
I found a great slideshow script i'd like to use @ Dynamic Drive. http://www.dynamicdrive.com/dynamici...nslideshow.htm
It does everything i want, except allowing the user to navigate to the Previous slide and Next slide. Basically, i'm trying to emulate what MSN already has on their home page.
Anyway, tried for a bit to get this thing working but unfortunately i'm a super-newb so no luck. Here's a sample page. Code:
I'm using a Volusion shopping cart and it uses JavaScript to insert code into DIVs with specific IDs. The code that it inserts can't be changed from the backend, so I'm wondering if there is a way to replace it with JavaScript after it's rendered.
Here is my problem specifically: I'm trying to change the wording "Find by Type" to "Sort by Type", but I can't modify it since it's being added in later by JavaScript. The tag I have in my template file is:
Code: <div id="search_refinement_filters"></div> but when rendered, Volusion turns it into: