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>
I want to repeat 3 .html file in every page of my site. (header.html, footer.html and navigation.html), I read something about php's include() function. but I like to use JQuery's .ajax() or get() function. How can I do that?
I'm using the script below in a custom HTML to generate a random line of text (not with the text shown here). This works fine BUT; I want it to go randomly through the WHOLE list without repeating lines that already have been printed. As it is now, a line of text might be printed several times in a row, which is a little annoying. I'm using a refresh button for generating a new line of text.
How can I just make it display in the order shown and just re-arrange the content so it seems random to the user? Random would the best though...
<script language="JavaScript"> <!-- var r_text = new Array (); r_text[0] = "All the leaves are brown";
I'm trying to simply replace a certain string from the contents of an element, I tried this: <div id="errorCont">Microsoft and Apple</div> var ErrorContText=$("#errorCont").html(); ErrorContText=ErrorContText.replace("Apple","No one"); $("#errorCont").html(ErrorContText); So the div SHOULD now say "Microsoft and No one", but it's not working.
I've got some text that I want to change what it says:(63%) on RRP (£80.00) The percentage value and RRP Price will change dependant on the product and its discount. All I want to change with jquery is the text:
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.
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.
We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole new page that should replace an existing one. I.e when we issue an Ajax request we don't know what will be returned and analyze the response to act accordingly.
Now, the way to replace the current document with a new one used to be easy and portable for both browsers (we're only supporting IE6 and Firefox 1.5):
document.open(); document.write( head ); document.write( body ); document.close();
where "head" and "body" are two parts of the result HTML. We had to cut it to two (rather than going simply with document.write( NewHTML )) because of IE - our head section contains references to external JavaScript files (<script type="text/javascript" src="sth.js"></script>) and IE only loads them when document.write() call ends. So if body contains any script block (<script type="text/javascript".. </script>) using any of JS referenced by head - IE would fail with something like "Resource undefined" if we push the whole new HTMl in one go by using document.write( NewHTML ). But it worked perfectly fine in Firefox, meaning
did the job just fine. What's even more important - it also evaluated all JavaScripts correctly - both in external files referenced by the head and in the JS blocks embedded in the body.
Until Firefox 1.5.0.6/7 where things stopped working completely - our lovely and used-to-be portable code
document.open(); document.write( head ); document.write( body ); document.close();
caused Firefox to loose all CSS/JS and display an HTML only page (as if CSS/JS were disabled). Removing document.close(); improved the situation a bit by displaying the page with CSS this time but still - *no* JavaScript was evaluated (meaning, JavaScript blocks embedded in the document's body were not evaluated).
I took a different path from this point by pushing the new content to document's head and body "innerHTML". It worked but not for JS evaluation - I had to do that manually. To evaluate the JS referenced in the head section of the document - I've traversed the head's DOM tree while looking for the "script" nodes, then downloaded all of them one by one using a synchronous Ajax calls (don't laugh!) and eval()-ed the response. To evaluate JS blocks embedded in the body of the document - I've traversed the body's DOM tree while looking for the "script" nodes and eval()-ed them.
The problem is following: eval()-ing external JS files after downloading them with Ajax doesn't work in 100% of cases - some statements using Prototype functions fail to execute ("prototype.js" is one of external JS files referenced in the head). Anyway, I'm almost sure that what I'm doing is plain wrong, i.e it's sounds silly to download all JS files referenced in the head and eval() them !
So how do I fix it ? Simply put - how do I replce the content of the document to the completely new one received as a response to asynchronous Ajax call ? The new content conatins doctype, head, body - it's a completely new page. And all JS referenced in the head and embedded in the body should be evaluated as well.
I really wish
document.open(); document.write( head ); document.write( body ); document.close();
was working in Firefox as before. Is it simply a Firefox bug, should I submit it ? Btw, document.open.write.write.close() works just fine in IE6.
It is a beginners problem I'm sure but I'm making a menu and when hovered, the submenu appear. However, when moving the mouse the submenu keeps fading in and out a few times. Why? Can I stop the function from repeating itself over and over? [code]...
i am making a request using Ajax (JQuery) and it keeps repeating the request, it almost seems like it is inside a loop even though it is not inside a loop.
I have an xml with nested repeatingentries. I want to parse it using jquery, I have tried .find methodbut it ignores the child parent relation and consider all as child nodesI want to parse it inhierarchy like first it should show top level categories then if have nested categories and then if have products and so on.
I have applied the fadeIn() and fadeOut() effects to a li>ul in my html, but if the user leaves the ul briefly then re-enters it before it has finished fading out, the ul fades back in again. This can happen many times over by accident and it's very annoying.
If the user leaves the ul I want it to fadeOut() and NOT fadeIn() again until the user re-enters the parent li element.Is there a way of ensuring this? I have done a quick search for while and if/then/else functions but haven't been getting anywhere. This is what I have, very simple indeed:
I'm using mouseenter and mouseleave to call a slideToggle on a dropdown menu. What's bothering me though is if my mouse moves in and out of the menu a few times before the toggle animation is complete and replays the open close a few times before stopping. [URL]... Is there a way to kill the queue so that it doesn't play if the mouse is not over it anymore?
I have content in hidden (invisible) DIV elements on a page that I want to load into another DIV element on same page. I need to replace content currently in a DIV with that coming from another DIV. DIV ontent could be a P element or a P and IMG element.
each time I hover on #demo, the piece of code below works, but it will not stop doing it even if I'm not on hover, it is like it will repeat the process all the times I hovered and didn't have time to repeat it.
How do I use jQuery to determine which textbox control is being clicked and then show the div that relates to that TextBox? Again, both the textbox along with the div=command are all repeating. It could repeat more than just twice as showing in the example above. I need the jQuery to only show the div=command that the user has clicked on the TextBox for commenting.
I displaying mysql data in a webpage using div's and tables. Each row of data has 4 div's, and a certain style. The 4 div's will be repeated for each row of the query result. I want to repeat the style for each set of div's as they are created. I imagine this would/could be achieved using and array of style id's such as: ID1a, ID1b, ID1c, ID1d ID2a, ID2b, ID2c, ID2d etc, etc.... How can I create/repeat these style ID's as I create/repeat the div's?