I am pretty new to Javascript and have only created a few pretty basic scripts, mainly dealing with site navigation and mouseovers. I would like now to redo my private home page using a rather complex configuration of frames. It is my intention to use JavaScript (variables) to control the rather intricate page navigation.
My question is this. I know how to define a variable, increment or otherwise alter it's value and how to change a process path based on the value of a variable. I have done all of this within the SAME page. What I would like to know more about is the referencing and modification of variables in "pages" in other windows within a frameset.
I have a javascript function that sets the value of an input area on my page. I need to update the function so that it also sets the value of the input area on a separate page. Currently, I am using a frameset, so I can see both pages simultaneously, but I cannot change the value of the upper page from the lower page which contains the script to update the input areas.
Here is my code: document.lowerForm.inputOne.value = myVar; //Successfully Updates Input Area. document.upperForm.inputTwo.value = myVar; //Cannot find specified form and input area.
i have a frame on my website that displays some information. I want to have a button/link that when users click, it will make that frame 100% width and height.
How can i do this?
I think this is done with javascript.
Also another question i have is:
I am including a webpage in the frame, how can i make it so it cuts off say the top 300 pixels of the target webpage?
There are tons of examples how to break out of frames with Javascript and I thought you couldn't do it without Javascript.
But YAHOO! does it! If you place www.yahoo.com inside an iframe and click on an item in the Navigation (say Autos) it breaks out of the frame even if Javascript is disabled in the browser. Works for both IE and Firefox.
The page redirects with a Location header a couple of times, but I tested that and it's not what is causing it to break out. To test simply create an html file on your desktop with the following contents: Code:
I try to print out five hidden frames throug a printing-form. I use the frame.focus() and the frame.print() functions. Everything is fine except the following little disadvantage:
When I print out the five frames, the print window dialog appears five time (for each frame once). The user has to confirm his standard printer several times.
I have a DHTML Folder Tree, also known as a TreeView. That is, an expandable/collapsible tree of links. In a frame-less layout everything works great. In a frame-based layout, it doesn't work on Safari/Konqueror.
There are two frames: the left frame contains the tree control; when you click on a link in the tree, the right frame is the target for the links in the tree.
The tree mechanism itself works fine. But there is a problem with the links. What happens on Safari/Konqueror with the frame-based layout is the first link works fine, but all links after that do not. That is, the first click loads a picture on the right frame, but when I click on any other links after that, the target frame is not updated.
I have a page with two frames, 'header' and 'main'. The following code works in Netscape, but in Internet Explorer. The second bgColor line produces an error:
function test(){ top.frames.header.document.bgColor='white' //works fine top.frames.main.document.bgColor='white' //fails }
I am designing a website for disabled football supporters and because of this, I obviously must consider accessibility to blind users whilst I am producing it - as they are one of the disability groups that I am targeting the page at.
The page basically consists of two frames; one being a vertical list of links positioned on the left hand side of the screen and the other being the main content pane, positioned in the remaining area of the screen on the right of the first frame. The first frame is used to drive the content of the second frame.
Now, I'm not sure if this is possible in JavaScript, or indeed in another scripting language, but what I want to do is to be able to alter the current focus or caret? on a web page when a link is clicked. That is, when the user selects a link from the left hand frame, then the new content is loaded into the right and the current focus jumps straight to this new information, as opposed to having to tab through all the same links again in order to put the focus there.
I know this is only a fiddly little thing but it is something that would really improve the usability of the site, especially with screen readers in mind.
I have a program written in Javascript and fully functioning which takes a user-selected directory name and then displays all the photos in that directory in a certain format.
I am now wanting to expand the program to allow users to optionally enter their own strings and the program will use all the photos from www.flickr.com which use that string as a tag.
I have a PHP interface to flickr (called PHPflickr) which collects all the relevant photo urls. I now need to get these images back into my Javascript so I can process them using the existing functions (rather than rewrite all my functions in PHP code and have two sets of functions in the program). I found on another thread a means to do this for a date variable:
but being completely new to PHP I'm not sure what "addslashes" might be or what formatting will be necessary if I am starting with an array of urls. Code:
I was just reviewing some javascript pop up window functions on my website and I descovered something... that I set the exact same variable name twice for both functions... which is bookWindow. I tested this for pages that use both functions and both types of pop windows work no problem. Is there a problem in that I use the same variable name twice? Is this considered bad form? Or maybe it makes not difference at all because the variable only gets used when it is called upon and then it leave memory.....
I have some image data in a Javascript variable, and I want to display it. I have a technique which works in Firefox but not in Internet Explorer :
<script> var testImage = <image data as a string> </script>
<img src="javascript:testImage"></img>
I understand that this should work in Javascript 1.2 and above, which supports null characters in strings. Does anyone know why this doesn't work in Internet Explorer?
can anybody put forward a sensible argument javascript's behaviour of creating a new global variable whenever I assign to a previously undeclared variable. I can't beleive this is just for the sake of convenience (surely we learned this much from basic).
here's my proposal: all "global" (document scope) variables must be declared by 'var' outside a function block.
failing that, does anyone know any patterns or tricks I can use to make sure I don't create a new global variable when I accidentally misspell a variable name?
Here's the situation. I have a static html page which we want to update to include some dynamic content. I want a counter that keeps track of the number of times anyone presses the "add" button, and display that number. So, that page would look something like:
Number of calls today: 5 Add | Reset
The "5" would increment with every click of the "Add" link. The "Reset" link would reset the counter to 0.
I have a Perl script that does all of the accounting stuff (opens a file that contains the number, increments it, resets it, etc). What I don't know how to do is to get the data from the CGI script to the web page. I'm imagining that you can use Javascript, but I can't figure it out. My CGI script can accept three options (add, view, reset). So it you call it like so [myscript.cgi?action=add], it increments the counter by one.
So, in a nutshell, this is what I want:
1) the web page to display the # of calls upon load. 2) When a user presses the "Add" link, it invokes the CGI script to handle the accounting stuff, then refresh the page with the new number of calls. 3) When a user presses the "Reset" link, it resets the counter to 0.
I was handed a project that, when launched, had some ajax problems--specifically, "Error: uncaught exception: Permission denied to call method XMLHttpRequest.open." That's easy enough to fix--found the call in the .js file that was referencing the development server instead of the live server, and I am aware of Javascript's same-origin policy, which makes good clean sense. Change that call, problem solved.
Unfortunately, it's not solved. I can change the reference from var url='http://www.devserver.com/function.php?id='+id; to var url='http://www.liveserver.org/function.php?id='+id; but that doesn't solve the issue of if someone comes to the page without the 'www' or to the other domain, whose TLD is a .com instead of .org.
In PHP, I'd simply write the function to dynamically generate the url string, using $_SERVER variables rather than hardcoding the url. But I'm no javascript guy. Any help would be appreciated.
I'd rather not have to put a php redirect in every page to make sure the url is what I want it to be. I'd much rather learn something new about Javascript.
A while back I was working on learning C++. However after finding out that making API's was too difficult I switched over to HTML and Javascript for a while to get it to do what I want without having to fry my brain on weird code statements.
Well now I've reached the barrier of being able to save data. For a while I've just had it to the point where the code I need is saved in a textarea and I copy and paste it in notepad. Then upon reentering I pull it out of Notepad and paste into the testarea.
Well enough with the bla bla bla. Is there a way I can use the <form method="post"> stuff to pass a variable to a C++ compiled program?
All I need to know is: 1) can I use <form method="post" action="SomeProg.exe"> and 2) what would the name of the posted variable be to use in my C++ code? As you can tell I running client-side so PHP and other server-side languages that WinXP don't support without special installation wont work.
I have something that runs on a server with no PHP or any of those widgets.
A user submits a form with 6 fields. Clicks "Go". A page appears that displays what he just entered, with a form of his data in hidden fields, and a link with document.form.submit() that takes you to a CGI program. It must be 2 different page loads.
Is displaying what he entered in the form in the next page possible with JavaScript? If so, what are the JS variables that would let me access that data?
I'm having a problem passing a variable through a URL because the variable is supposed to hold a URL that has a variable of its own. Here is an idea of what I'm trying to do:
That code happens within a loop, and sub_menu_id has a different value through each iteration of the loop. For example, if it loops 4 times, then there will be 4 onclick functions and sub_menu_id would change for each one. This should happen in theory, but instead, whichever item you click on, sub_menu_id takes the value of its last value in the loop. (4 in this example)
My question is, how do I make the function toggleSubMenu take the value of sub_menu_id at the time the on click function is created (i.e while looping) rather than taking the value of sub_menu_id when it is actually clicked.
There will be a number of list boxes and other controls, with pop-up windows to edit certain properties. It's the kind of thing I would normally have done in VB but I want it to be browser-based. I've only used javascript for trivial things before so this would be my first serious javascript development. I would like it to run on all reasonably recent browsers.
The form starts with all the initial values being received from the server (presumably just by pre-initialised data structures). The user tinkers with it and when he is happy he presses 'submit' and the whole lot is submitted to the server (presumably as a form post). This would be a few kb of data, possibly 100 individual values but obviously in various data structures. I guess there would be a few hundred lines of javascript code to manipulate it.
My question is, is there likely to be a problem with manipulating and sending this amount of data in Javascript. Sorry if this is a dumb question, but like I said, I only used javascript for tiny programs before, so I'm a bit unsure about its capabilities.