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).
I'm trying to create a piece of code that will check a webpage and replace any instances of a specific line of HTML with another line of HTML. The code I have so far doesn't work, but I have a feeling that's down to my awful Javascript skills! For example, in the following code I'd want to replace all instances of <li><a href="index.pdf">Index</a></li> with <li><a href="contents.pdf">Contents</a></li>
The Javascript I have so far is: <script type="text/javascript"> var aEls = document.getElementsByTagName('a'); for (var i = 0, aEl; aEl = aEls[i]; i++) { aEl.href = aEl.href.replace('index.pdf','contents.pdf'); } Obviously this is meant to just replaces the a href elements, but I got a bit stuck after this!
I have this page created, And in the page is a news header, In the header it says %ss%. Can someone help me create code, so that in the footer of the page javascript finds this %ss% and replaces it with text from a webpage?Code:What the web page that needs inserting does:I have this game and it uses php fsockopen to determine if a port is open. If the port is in use the page displaysThe server is <font color="#0066FF"><b>Online!</b></font>Otherwise it's:The server is <font color="#FF0000"><b>Offline!</b></font>
This line replaces only the first " " spec. character in my textarea, and this way everything's screwed up... I'm sending the replaced content of the textarea through AJAX to the server, in a GET method. I've tried to just comment out this line to see whether this is necesarry, but then no " " is transferred at all... I'm using a PHP server side, and that works.
getting first line coordinates of multiple line inline element.
Example HTML aaa bbb ccc ddd <span id="target">eee fff ggg hhh iii jjj</span>kkk lll mmm nnn ooo ppp qqq $(document).ready(function() {
[Code]....
Assume that span#target has a line break, when I see a browser. Then I click span#target, above function returns the head of coordinates which second line ("hhh") has. I want to have the coordinates which first line ("eee") has. How can I get that?
How do I read a local text file line by line, one line at a time. I got upto opening a file, and can read whole file at a time. But I want to read just one line at a time. May be have a counter of lenght of the file and read only the counter number line at a time.
<SCRIPT language=JavaScript> var fso = new ActiveXObject( 'Scripting.FileSystemObject' ); f = fso.OpenTextFile( "c:\mytextfile.txt", 1 );
I have a user that insists they have web applications that do this, and wants the one I'm building to do it too...
You have a table on an html form. As the user changes one or more fields in a table row and moves to the next line, the changed row should AUTOMATICALLY be sent back to the server and updated in the database.
If the user moves BACK to a line that's already been changed, and changed a field, a popup should display and ask "if the user really wants to change the field". If so, again, it should AUTOMATICALLY be sent to the server and updated in the database...
Ignoring the horridness of making that many round trips to the server and banging the database for every line, is there a way to AUTOMATICALLY do the equivalent of a submit and post the changed table row back to the php script?
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)
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.
<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.
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.