This forum thread discusses the SitePoint article 'Re-Write a Layer's Content with Javascript' by Peter Todorov.
"How can you can replace the content of a Web page without additional requests to the server? The answer uses layers in JavaScript - Peter explains all."
I use a small piece of JS code to make different elements on the page show/hide when clicking a link, based on id:
function toggle( targetId ){ if (document.getElementById){ target = document.getElementById( targetId ); if (target.style.display == "none"){ target.style.display = ""; } else { target.style.display = "none"; } } } Then HTML looks like this: <a href="#" onClick="toggle('news'); return false;">Show/hide news</a> <div id="news" style="display:none">BlahBlahBlah</div>
This works. Initially the element is hidden (with style="display:none" property of the element), and the script gets its id and changes its display property to "block" when clicking on a link.
But when Javascript in a browser is turned off, the elements to show are all hidden, and there's no way to see the content of the element.
My question: is there a way to hide toggled elements on page load with JS, so that when it's turned off the hidden content is shown?
I am a .Net Developer. I want to know to write javascript for serverside controles.And where it is placed for sever sidr controls. Please tell me if any one know this.
I am using a standard javascript that I downloaded from javascriptsource.com to read from and fill in a form using cookies. The page tests well in every browser except Apple's Safari (from 10.3.2)
Unfortunately, my clients daughter uses Safari so I have to get it to work with it, even though most of his clients use IE.
What do I need to do to change the code so this will all work in Safari? Code:
I'm back after giving up two years ago to write a page of html code with javascript in it.
I want to display a table with five images (tumbnails) per row with the name of the image (my code number for the image) under it. I want 4 rows of images for a total of 20 images (tumbnails).
I want when someone clicks on one of the tumbnail images a new window opens with the fullsize image displayed.
I have written an html page that does this but I have over 50 such pages that I need to create for my website. Here is the code that does this for each table image cell. Code:
IE 6.0 (not interested in other browsers at the moment)
I have looked everywhere I can find to look and googled until I am cross-eyed and am hoping somebody knows what I'm doing wrong.
I have an HTML application (.hta) working fine, except one thing. I'm trying to write to a local database from a .htm window (opened from the main .hta window) and it doesn't work with any of the combinations I've tried (and I admit to having tried a lot).
Here is one method I've tried:
strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;" var db = new ActiveXObject("ADODB.Connection"); db.Provider = "Microsoft.Jet.OLEDB.4.0";0 db.ConnectionString = "Data Source='c:myDirectorymyDatabase.mdb'"; db.Open; db.execute(strSQL);
I can easily access the information in the myDatabase.mdb and display it on the screen.
I can ask for updated information to be input on the screen.
But stuffing that updated information back into the database is the problem.
Since I'm stuck in an .htm window, I don't have VBScript available, do I? If VBScript isn't available and it isn't physically possible with Javascript, then I'll have to revert to .hta windows, where I know I have VBScript available. But I'd rather do it all in Javascript within the .htm so as to avoid the security message that pops up when the .hta opens a new .hta. For various reasons I don't think it is possible for me to do this whole project within a single .hta.
The assignment is: Write a JavaScript program to find all Pythagorean triples for side1,side2 and the hypotenuse, all no larger than 500. Use a triple-nested for loop that exhaustively tries all possibilities.
PHP Code: <script type="text/javascript"> var side1;
I am totally new to jQuery and no good knowledge on javascript. However, I was assigned a task, to convert a javascript program to jQuery due to compatibility problem on browsers like Chrome and Safari. My program originally use javascript xmlDoc.load('....') to read XML file, and then use document.write statement to write html tables on client side. Something like this (the sample below may got lots of syntax problem as I jut want to show the major part):
Code: document.write('<TABLE >'); var y=x[0].getElementsByTagName('NoOfRows'); for (i=0; i<=noofrows-1 && i<=y.length-1; i++){ document.write(' <TD>'); document.write(z[j].getElementsByTagName('RecordDetails')[0].childNodes[0].nodeValue; }
Now I changed to use jQuery, I can read the XML file elements. However, when I try to write the table, it failed:
I have a client that has ads on her website that really slow down the site. These ads are called by an off site javascript file and I want to use a jQuery(document).ready or similar method to call these files after all of the site content has loaded. But these files contain document.write functions to add more javascript files. Since I want to load the files after everything else has loaded, this in turn makes the page blank and then loads the ad. Is there a way to position where document.write will write to?
When I place the script.php in other servers it works fine (content can be viewed) except with one server, it doesn't return anything (just blank screen). What could be the possible problem, is it a hotlinking issue or something else?
i made this javascript using the new "screen.width" property, which would make it easy to center content in a webpage no matter what the screen resolution is. Here it goes:
<html> <head> <script type="text/javascript"> function pos_center() { var content = document.getElementById("carrier") var width = screen.width var contentwidth = content.offsetWidth value = parseFloat((width - contentwidth)/2) content.style.marginLeft = value } </script> </head> <body <div class="body" id="carrier"> </div> </body> </html>
The "body onload" makes the page first load all the way to the left, and then after completely loading switches the content to the center, that is dynamically gross. Now, instead of using the "body onload", is there any other way that i can make the content appear. Seeing that there is no "onbeforeload", there must be another way to solve this.
I have a company that has a group of companies under it. I plan to add 4 company logos on one front page, and when the user mouses over one of the logos, I want a table below to change and show a description of that company.
The images that they will be mousing over will also need to change, and the table that will change should be able to carry a static message such as "Hover your mouse over the logos above to find out more".
I would like to build an HTML page that has four content areas. The first with 3 links that when clicked chage what is shown in the other 3 - and so changing the default content in these sections. The content for these sections will be contained in seperate HTML files sitting on the same server.
I understand this can be done without refreshing the page and believe JavaScript and Ajax is the best method to do this. Any advice?
I'm sure some wizard will tell me this is a classic example of "piece of cake"; in which case I bow and promise to listen In case I've struck granite rock, feel free to throw questions my way and I'll tell you if I've tried it or not.
I have a file, main.php (I know this is the JS-forum, bear with me). It outputs HTML and inline Javascript functions. When the user clicks on a graphical "tab", that tab is activated, and an ajax call is made to fetch.php with some specific parameters. Once the ajax request has completed, a given innerHTML container on the now active tab is filled with the stuff that fetch.php outputs.
So far so good.
The problem is that the stuff that fetch.php outputs is partial pure HTML and partial inline javascript. And this is where it gets tricky. If I declare an inline javascript function in the returned data, Firefox (and I suspect MSIE) refuses to understand that the function is there. It simply doesn't exist (!).
Using the Web Developer add-on for Firefox, there's an option to look at "Source code" and "Generated source code". The output from these two differ in that when I view the "Generated source code", I see the dynamically inserted javascript/HTML from fetch.php, whereas viewing "just" the source doesn't.
What did I do wrong? How do I get the browser to find/accept/activate the javascript code/functions that were inserted dynamically? I cannot put them in a .js file and include it, since they need to be dynamically created, and I cannot use eval() since that executes javascript "as is", in which a function will not be executed unless called.
When viewed with Firefox. The show/hide function doesn't work as expected (evident when viewed). Anyone know why? Which bit is FF not liking and how can it be altered to be cross browser friendly?
Hey guys, im just learning how to use layers in css, and am trying to change a div like a targeted frame so that I can change content that is floating ontop of another image. So far I got that to work, except when I put in any embedded videos or image tags, then it stops working.[code]