So to start out, this is my first post on CodingForums! :) I've only recently started learning web development so I figured it would be a good idea to get involved with some active forums.
I am trying to open a random page in a frame, but I am trying to call the Javascript to do so in another frame. I currently have an html page with a frameset which has two frames. One of the frames is a toolbar that sits at the top of the page and it has an image that acts as button. When the user clicks on this image, the bottom frame generates a random page from an array of links I have hardcoded into the Javascript. The bottom frame is just set to google.com as a default because I couldn't really think of anything to put in an html file there.
The problem I'm having is when I click on the image to open a random page in the bottom frame, nothing happens. The code for all the files are below. code...
Following code. I wanted to generate a set of random number on the pinpad everytime the page is being loaded. (1-9 but the number can only appear once)
i need to display an image randomly from an array that holds 4 addresses to 4 different images.i am having a hard time writing the img tag to the html page that will display the image.is it possible to use document.getElementById('id').innerHTML= "<img src="imgurl" />"?i have a span with an id of "theImage".i want to plop the img tag inside this span tag, but can't seem to get it to work.
I have a table with a couple random numbers, and i want to click a button that will dynamically regenerate the numbers each time the button is clicked without re-generating the entire table., im using DOM and innerhtml for these random numbers. heres the javascript and html code. so far, it just generates the random numbers when the page loads.[code]...
I have a table with a couple random numbers, and i want to click a button that will dynamically regenerate the numbers each time the button is clicked without re-generating the entire table., im using DOM and innerhtml for these random numbers. heres the javascript and html code. so far, it just generates the random numbers when the page loads.code...
I've got my code, and the task is to generate two random numbers, the user then inputs an answer for them added together, then the program checks the answer and displays either "correct" or "wrong". Here's some of my code:
Code: <HTML> <TITLE>Assessment Task 3 : Rohan Gardiner</TITLE> <HEAD> <SCRIPT LANGUAGE ="JavaScript"> function maths(){ var response; var answer; answer = document.questions.answer.value; if (answer==document.adding){ response = "correct"; } else { response = "wrong"; } document.questions.result.value = response ; } function randoms() { rndNum = Math.random(); Num = rndNum*20; Num1=rndNum*10 document.write(Math.round(Num)+"+"+ Math.round(Num1)); } function adding() { document.write(Math.round(Num) + Math.round(Num1)); } </SCRIPT></HEAD><BODY> <h1 align="center">Rohan Gardiner Assessment Task 3</h1> <FORM NAME = "questions"> <SCRIPT Language=JavaScript> randoms(); </script> = <INPUT TYPE = "textbox" NAME = "answer" > <BR> <INPUT NAME = "dobutton" TYPE = "button" Value = "check" onClick= "maths()"> <INPUT TYPE = "textbox" NAME = "result" > </BODY></HTML>
I'm trying to generate random numbers 0-8 to use to access array indices.[code]Every once in a while, I'm getting a -1 in my console log. I read on a site that this line:[code]will generate a number between 0 and 10 (so 1-9).How is -1 being generated?
I am using a very simple search-type page to enable users to input a model number and its page appears in a inline frame. Its not a true search as it is simply relying on a person entering the correct html page name to find it. But this works perfectly in my application.The problem I have is that I cannot get the type box to accept enter key as a submitt, only a click of the mouse will submitt the request. If enter is pressed the box loses the users input but no action is taken.I think this may be a javascript issue. I have posted the code below.
if i have 10 pages and each of the page has the same navigation bar, i don't think duplicating the code again and again in every page is the right solution... what do the pro normally do? i tried to use a frame inside one of my div tag to link the page to the navigation page
How can I avoid that a site that I send to a frame (via target=...) overrides the whole frameset and claims the whole window. I want the site to appear in that frame and not grab the whole browser window...
The problem is that the pages spill over to another page (in all printers I've tested - and in a pdf) BUT (and this is weird) if I print the page OUTSIDE of the frames, they print out on one single page as designed. The javascript used to print the page is simple enough:
function printit(){ window.parent.middle.focus(); window.print(); }
...but i don't think the function is the problem.
Does anyone know why a page would print out differently (i.e. longer) if inside a frame in a frameset, why this should be so, and what I can do to prevent the difference and have it print like a normal page?
I have a site using IFRAMEs and I don't want pages viewed without being in the IFRAME. Is there a way to do this? The pages just don't make much sense unless viewed in the IFRAME. I'm not trying to protect information or anything.
[URL] I have an index.html that sets up 3 Frames. They are called FrameTop, FrameA and FrameB. See pic below. In FrameTop the user can type in a url into a textbox with id="urlINPUT". When user clicks LOADA it loads that url into FrameA. User can then browse web in FrameA, clicking links etc and going to new pages. The second button LOADB is designed to determine the current location/url of the page displayed in FrameA and load that into FrameB. So far when I write the javascript in FrameTop LOADA works but LOADB loads the FrameTop into FrameB! [error!]
I suspect my error lies in use of parent/self in the parent.frame.location.
index.html loads the index correctly and displays FrameTop, FrameA and FrameB. The load A button also works correctly BUT when I click LoadB it loads FrameTop into FrameB! This happens when no page is loaded into FrameA AND when an external page in loaded in. [URL]
Can I create a frame in the same page without referring to other html files? I.e., I have a large dynamically created table in my JSP page. I would like to place it inside the scrollable frame. If I put the whole table into a separate file, I can easily do it by referring to that HTML file from the 'src' attribute. But what if I want to create this frame in the same page without referring to the outside html files?
I tried to place my table content inside the anchor link and then refer to it from the frame like this:
Does any one know how to load a sertain page in a sertain frame depending on the viwers screenresolution?
What i mean is that if a user has 800*600 i want page 800.htm to be loaded in frame "content". If the user has 1024*768 i want page 1024.htm to be loaded in frame "content".
I have a code which works ok, except I would like to load the specified file in an inline frame (I1) on the page instead of a whole new page if at all possible Code:
I have a domain: example.com; which is the parent.And a subdomain: api.example.com; which page 'receiver.html' is being loaded in an iframe, child of parent. Both pages set document.domain = example.com.
I'm trying to adapt this code:[url] but Idon't want to load jQuery from the <iframe> again but I need to have the method $.ajax() working from the <iframe> otherwise it would be a cross-domain request and the browser would abort it. I tried ingenuously to set via $('iframe')[0].contentWindow.$.ajax = $.ajax() and I just got a shortcut to the parent page jQuery method. I also tried to "clone" it using $.expand (true...) but the method doesn't work for me; probably because of the complexity of the objected I'm trying to clone. So is there a way for me to use jQuery to have only a $.ajax() method in the <iframe> ? I've thought even about creating a XHR in the child-iframe and then use that in the $.ajaxSetup ({xhr: THATNEWXHR}) but I couldn't do it. I mean, I want to use the XHR factory from jQuery (which has fallbacks for IE, etc) but it has to be created from the iframe-child.
Maybe there is other way to make the AJAX call come from the child-iframe.
If you're wondering "why don't you load jQuery from <script> in the child-iframe", there is a reason... As I'm using jQuery plugins + my own custom javascripts + other independent scripts I created a compiler which minifies each file and bundle them in one. The advantage of this is the reduction of HTTP requests. So "why don't you load that bundle inside the child-iframe?", because it's ugly and Twitter doesn't... Yeah, I like to take Twitter as a reference and I think if they were able to make it so can I;
I got to work in most browsers except IE and Operaby doing it with pure javascript.
I'm "attaching" the code for you guys to test. If you open it with Chrome, Safari or Firefox you will receive 2 alerts one with the return of $.get() and another with the return of a request made via XMLHttpsRequest object. Otherwise (if you open it with IE or Opera) you'll get 'undefined' in the first alert but the real return in the second.
Im trying to make a back button that reloads the previous page the user was at. The back button will be on a small top frame and the page that needs to be controlled will be in the main frame.
The top frame is just a navigation system, and all pages will be loaded in the main frame. Im trying to use this Code:
What is the standard practice to verify that a page has loaded succesfully in a frame when one issues a framename.href="url"? For example, detecting 404's, or other errors (like domain doesn't exist).
I look for a script allowing to display a page in a frame as from a link in a pop up (and close it in the same time The name of my frame is "body" In the pop up i try this function in the head section :
function reroutage() { parent.frames["body"].window.location="assistance.htm"; window.close(); }