I'm trying to get my head around DOM and it's usefulness in designing web applications. Some of it is pretty straight forward, while some is kind of vague. What I am trying to do now is write data to a page. I want to fill in the data in the second span below.
var posSize = document.createTextNode(Ǝ'); parent.document.getElementById('size').appendChild(posSize);
But as the name suggests, it appends it to the current value. So every time I click something on the page and the value needs to reflect that item, it just appends it to the former value.
I have to replace two keyboards. I have functions that generate alphabetical keyboard on the screen and normal computer keyboard. They both have button which should switch them like, for example, the default keyboard should be the computer one if you click the button alphabetic it should change to the alphabetic one which on the other hand has a button that can return the default one. So I wonder how to make the change between them. If I use document.write everything goes away... if I use appendChild it adds the keyboards one after another when I want just to replace them. I am really stack on this one.
I have a script which gathers information from a form and, if needed, writes this info to a 'preview' window. At times {tokens} are used in place of real html tags. How can I tell the script to look for "{" and "}" and replace them, respectively, with "<" and ">".
I tried using "str = str.replace(/{/g, "<").replace(/}/g, ">");" but that didn't work. The script in question is being written by PHP... thus, may be generating a syntax-based failure. Any ideas?
What I want, is the code to look for a particular ID of an img, and then change the filename (but not the whole path) of the image.
For instance... if the path was "../images/headin.gif", the javascript would find this by the ID, and change to "headin" to "headdown".
I know I can do something like... if(a.getAttribute("img").indexOf("headin")) {
but then I need to know how to replace "headin" with "headdown".
How can this be done?
(the reason I don't want to replace the whole src, as that would be very simple, is that the path of the image will change depending on the directory the page is in)
<input name="add" type="button" value="Click To Add Another Box">
Now, if I add another box, then type some text into it, then add another box, the box I just typed into is replaced with a new box, and a new box is added. How do I just make it add a new text box instead of replacing a current one?
I have a page that contains several HREFs. Each HREF that I'm interested in has a common parameter (parmX). Does anyone have a script example on how to find-and-replace parmX with parmY?
I'm assuming that I'd need to do this in the onload event - but I don't know much about Javascript.
where the selectors and their opening braces, their closing braces, and declarations are each on their own lines (always), how can I replace a specific declaration (line) given a unique selector and a declaration property. For example, if I wanted the 'color' declaration property line in the 'bar' class changed.
At the moment I'm iterating through the CSS one line at a time looking for the selector and then looking for the declaration property (before I hit the closing brace).
New to JQuery, but making progress, not sure how to describe this issue, so stay with me. In JS I would build a function that I could call from a variety of actions, including other functions.
eg.. function dosomething(someparam){ // does something. } function dothis(){
Code: tr><td><div id="ref">hh</div></td><td>edit button</td> what I want to achieve is that when a user clicks on edit button, first of all hh should be replaced by a text input field and edit button change to update
I am developing a simple image editor in an HTA (for a special use-case). Because it is an HTA, it runs in IE only (IE7 to be precise).
Everything is working great so far, however, because I am loading the same img src file over after every edit, I had to attach " + Math.random();" to the image src so that the updated image is displayed.
This has lead to some pretty severe memory issues, as each time I make an edit, it caches another image. Under normal operation, my app uses under 20MB with a single image loaded, however after every edit it adds about 3MB. After a few minutes of testing I have had it consuming over 200MB!
Is there another way to use the same file name, same image src, etc, but have the browser re-read the file before displaying it again rather than using a cached copy.
Alternately, is there a way to make the browser forget about the other copies it has in memory to keep memory usage under control.
Im not all to sure what I can do right now. I have a script that I wrote for a userlookup on some website, problem is they have filtered out some key elements, to keep hackers away. Now, heres my problem. How can i make this return the same value, without using eval()
function doc() { var f = Array (1); f[0] = 'var d = doc' f[1] = 'ument;' eval(f.join('')); return d; }
i have two iframes side by side.i want users to type a keyword in a search bar,click, and the keyword would replace a (specified) characters in the iframes and display the content.
*so, upon entring a keyword in a search field(and clicking) the keyworld would replace all @@@ in iframes.
i have tried several codes including remote scripting in iframe. does is involve PHP? i can't seems to understand. can anyone please give me code and instruction on how to use it?
On certain pages, I display 10 pictures as thumbnails and one in the center to view as the main one. It works pretty nice but its not working for me in FF .. so I have to upgrade my coding methods here.
I have named the picture in question 'swap' in the html. The command that activates the swap is here:
function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} }
Now to note, that I am not doing a rollover here, just click and swap the image.
i'm trying to figure out how to access my input text with a variable:
Code working: function 123(param){ var x = document.form1; total = 0; if(x.txSecurApp.checked){ total = parseFloat(x.tAdulteA3.value) + txSecur; } else{ total = parseFloat(x.tAdulteA3.value); }}
Trying to : function 123(param){ // param is tAdulteA var str = param + Ɖ' var x = document.form1; total = 0; if(x.txSecurApp.checked){ total = parseFloat(x.str.value) + txSecur; } else{ total = parseFloat(x.str.value); }}
the var str is the problem, can i access my input this way.
I need to remove this in the XHTML and replace it with a Javascript function that does the same thing. (<?=$bgImage?> is a random file name returned by PHP)
Code: <style type="text/css"> html{ background-image:url(core/images/bg/<?=$bgImage?>); } </style> The site uses a session var to rotate the bg only if its been 10 seconds (for testing, The final will be 1-2 mins, or i may disable the rotation and simply give the user a unique bg with every visit)
I'm not sure how to target the html elment in the CSS document to change the backgroundImage.
I'm new to Javascript but did this script which displays answers when you click on a link (like a quiz). Actually i've got an arrray where I store my answers. When I click on the link below, the answers have to be displayed after replacing certain characters in them. I'm stuck with the last part. Code: