spipe Posted April 21, 2006 Share Posted April 21, 2006 Hello new to the forum and new to javascript and anything related to java. I have been looking into iframes and was wanting to take this code <iframe name="I1" src="http://www.maxmoneycasino.com" style="width:100%;height:100%" marginwidth="1" marginheight="1" scrolling="no" border="0" frameborder="0">Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></p>and have it in a js file so I can link it with a <script language="Javascript" src="http://gamblefacts.com/redirect.js"> </SCRIPT>I am sorry if this is unclear please post if you need more information. Link to comment Share on other sites More sharing options...
scott100 Posted April 21, 2006 Share Posted April 21, 2006 put it in a document.write()document.write('<iframe name="hello">etc</iframe>');http://www.w3schools.com/js/js_whereto.asp Link to comment Share on other sites More sharing options...
raimo Posted April 21, 2006 Share Posted April 21, 2006 put it in a document.write()or create it with DOMvar iframe = document.createElement("iframe");iframe.setAttribute('height', '100%');iframe.setAttribute('width', '100%');iframe.setAttribute('scrolling', 'no');iframe.setAttribute('frameborder', 0);iframe.setAttribute('marginwidth', 1);iframe.setAttribute('marginheight', 1);iframe.setAttribute('allowtransparency', 'true'); //MSIE transparent backgroundiframe.setAttribute('id', 'I1');iframe.setAttribute('name', 'I1');iframe.setAttribute('longdesc', '');iframe.style.border = 'none';iframe.setAttribute('src', 'http://www.google.ru/');document.getElementsByTagName("body")[0].appendChild(iframe); Link to comment Share on other sites More sharing options...
aspnetguy Posted April 21, 2006 Share Posted April 21, 2006 I have been forcing myself away from using document.write because I am finding that it is not performing consistantly in different situations. Sometimes it re-write a new page losing all previous page data before document.write was called and not displaying the content after the call either.And then sometimes it works like a charm...can someone explain why it does this, what the cause is.Until I figure it out I am using the DOM Link to comment Share on other sites More sharing options...
spipe Posted April 21, 2006 Author Share Posted April 21, 2006 Ok so how do I use these examples? The DOM i have no clue how to create this do I put it in tags a file or how? I am wanting a redirect in an iframe but have a src link on another server I want this for search engine perposes.I am 2 hours old in javascript so talk to me like a moron please I dont mind lol. Link to comment Share on other sites More sharing options...
raimo Posted April 21, 2006 Share Posted April 21, 2006 Ok so how do I use these examples? The DOM i have no clue how to create this do I put it in tags a file or how? I am wanting a redirect in an iframe but have a src link on another server I want this for search engine perposes.I am 2 hours old in javascript so talk to me like a moron please I dont mind lol.<{POST_SNAPBACK}> DOM-code is ready, no tags or anything else need to add:Copy-paste the code from code-box and save it to file named iframe.jsthen in Your HTML say:<script src="iframe.js" type="text/javascript">//</script>where ever You need iframe (change name and id in DOM-code). No any other tags needed in HTML.Change Your URL here:iframe.setAttribute('src', 'http://www.google.ru/');If there is problems with height change this:iframe.setAttribute('height', '100%');to this:iframe.setAttribute('height', screen.height);or even this:iframe.setAttribute('height', screen.height + 500); Link to comment Share on other sites More sharing options...
spipe Posted April 21, 2006 Author Share Posted April 21, 2006 Wow thanks Im glad you people have this forum for idiots like myself really helps. Link to comment Share on other sites More sharing options...
scott100 Posted April 21, 2006 Share Posted April 21, 2006 That's strange i have never had any problems with document.writeor simply <head><script>function showIt(){ document.body.innerHTML='<iframe src ="http://www.google.com" width="100%"> </iframe>';}</script></head><body onload="showIt()"></body> Link to comment Share on other sites More sharing options...
Webworldx Posted April 22, 2006 Share Posted April 22, 2006 Eep. I wouldn't go rewriting the innerHTML of the body, or appending to it after load.aspnetguy, i've also noticed the rewrite thing, but that's often after the page has loaded and the document has close()'d itself, writing to it would cause a new page to be created.DOM methods are the nicest way, appending to the body or removing that way Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now