Re-Write A Layer's Content With Javascript
Mar 26, 2003
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."
View 17 Replies
ADVERTISEMENT
Aug 5, 2003
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function do_write(text2write)
{
window.frames["screen"].document.write(text2write);
}
//-->
</SCRIPT>
<TITLE> Testing Document </TITLE>
</HEAD>
<FRAMESET ROWS="*,40" COLS=",">
<FRAME SRC="screen.html" NAME="screen">
<FRAME SRC="writer.html" NAME="writer">
</FRAMESET>
<BODY onload='javascript: do_write("hello world!");'>
</BODY>
</HTML>
I want to use javascript to change the content of a frame from the frameset page, but the above code does not work.
View 2 Replies
View Related
Jul 21, 2007
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?
View 5 Replies
View Related
Oct 13, 2005
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.
View 1 Replies
View Related
Oct 25, 2004
How do you write javascript function value to <input type='hidden' name='example' value='function()'>
View 7 Replies
View Related
Dec 1, 2007
Basically, I have a button which when clicked, should write some html to the page at a specific location. Here's the html currently in the page Code:
View 8 Replies
View Related
Jul 20, 2005
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:
View 1 Replies
View Related
Oct 19, 2005
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:
View 12 Replies
View Related
Jul 23, 2005
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.
View 9 Replies
View Related
Jul 23, 2005
I am getting syntax errors in my JavaScript code, code snippet as follows
(between my <script></script> tags:
View 2 Replies
View Related
Nov 7, 2010
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;
[code]....
View 2 Replies
View Related
Jul 27, 2010
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:
[Code]...
View 1 Replies
View Related
Aug 5, 2002
Why doesn't this work? The input field doesn't show up at all. I know I'm just missing something really simple here.
<script type="text/javascript">
day = day.getDay()+1;
month = day.getMonth()+1;
year = day.getYear();
newdate= month + '/' + day + '/' + year;
document.write('<INPUT name=Date value='+ newdate + '>');
</script>
View 2 Replies
View Related
Mar 24, 2011
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?
View 1 Replies
View Related
May 27, 2006
I've been driving myself crazy the past couple hours and can't figure this out. Here is what I need to do:
Have a select box like this:
<select name="dropdown">
<option value="option1">option1</option>
<option value="option2">option2</option>
</select>
Then when one of those options is selected, the appropriate div tag is displayed:
<div id="option1">
Div 1 Text
</div>
<div id="option2">
Div 2 Text
</div>
This seems like it should be really simple to do, but I can't figure it out.
View 5 Replies
View Related
Aug 2, 2007
I am trying to embed content via javascript using the following code:
<script type="text/javascript" src="http://example.com/script.php"></script>
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?
View 8 Replies
View Related
Jul 28, 2007
I have a piece of code that I'd rather google's spider did not follow. Is
this possible please?
View 8 Replies
View Related
Mar 25, 2007
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.
View 1 Replies
View Related
Mar 6, 2004
I'm pretty new to JavaScript and am having a problem. I thought what I am doing should work but it isn't.
Basically I have a form that people can put a quantity into. e.g. A, B, C.
I have a JavaScript function called comput that assigns values e.g. A = 5, B = 7, C = 9. Here is the start of the script:
<script language="JavaScript"><!--
function compute(form){
var A = form.A.value * 5;
var B = form.B.value * 7;
var C = form.C.value * 9;
I then declare a variable to add them up:
var ans = A+B+C;
return;
}
</script>
This part of the script works fine. Now I want to write the ans variable. So I use:
<script>
<!--
document.write ("Your total is "+ans+"")
// --></script>
But it isn't working. Any ideas?
View 3 Replies
View Related
May 4, 2005
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".
View 7 Replies
View Related
Sep 29, 2005
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?
View 2 Replies
View Related
Jun 26, 2007
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.
View 5 Replies
View Related
Jul 23, 2005
How can I scoll the content of an Ifram to a desire Position?
The function should be:
window.scrollTo(x,y)
BUT how do I have to use this function so that applies to the IFrame content.
View 1 Replies
View Related
Jul 23, 2005
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?
View 4 Replies
View Related
Nov 9, 2011
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]
View 1 Replies
View Related
May 30, 2007
i'm using a little "ajax" loader script to dynamically load files into
different "div" tags on my main site. the code for this part looks
like:
View 13 Replies
View Related