JavaScript - Javascript Iframe Project
Hello all i am working on a project. i would like to know how to remove the scroll bars , and how to align the captcha/webpage that loads in the iframe.
<title>Test Raid Page</title> <script language="JavaScript" type="text/javascript"> <!--Begining of Java Script- function buildiframesA() { var rlink = prompt('Enter Raid ID:',""); var a = document.createElement("iframe"); a.setAttribute("width","330"); a.setAttribute("scrolling=no"); a.setAttribute('******', 'ifrm1'); document.body.appendChild(a); a.setAttribute('src', "http://*****.******/joinraid.php?raidid=" + rlink + "&suid=******&serverid=2"); } </script> Anything with "************" has been removed due to privacy i added this code in a.setAttribute("scrolling=no"); and it disables the whole script but, in dreamweaver shows it is fine, when i load to debug and click group a to load the frame nothing happens, ive tried many ways to disable the scroll bars and cant figure a way out. There is more to the script this is just my test for the iframe, what i have is groups, all accounts are grouped in groups, when a group is clicked, i am prompt with Enter raid ID, i enter the raid ID and the frames for how ever many people in that group load, on those pages that load in the iframe is a raid page with a captcha to join the raid, the captcha shows automatically in the frame but it is not perfectly aligned as i want it to be. I use dreamweaver and can debug in my browser, any help is appericiated, i can also post pictures as to what i am talking about. EDIT: i also forgot to say i am new to javascript, i know html and php very well.. MrGato =D Similar TutorialsBuilding an inventory of financial models. 500-1000 small models. Need a few more programmers for launch.
A. Start. B. Display a prompt dialog box and store the user's input in UI. B1. Store UI acquired from a prompt dialog box. B2. Parse UI as a Base-10 integer and assign it to variable TV. C. Initialize the HITS counter to zero. D. Initialize the DD variable to the value of TV. E. While DD is greater than zero, repeat the following steps: E1. Test if the TV is evenly divisible by DD (that is if the remainder of TV/DD equals zero). If so, increment HITS by 1. E2. Decrement DD by 1. F. Display results within an HTML paragraph the browser's document window as seen in the Sample OUTPUT. F1. The string UI. F2. The string " is" F3. If HITS is greater than 2, then display the string " not" F4. The string " a prime number." G. End. This is what i have so far: <script type="text/javascript"> var UI=prompt("Enter a whole number to test as a prime number:"); var TV=parseint(UI); int HITS (0); int DD (tv); In college i need to make a website, i have chosen to do one about gaming. One of the tools i want to add in about javascirpt is how to get a Xbox360 Gamercard to be in a corner off the website and updates when new achievements are earned. I understand i need to be able to connect to xbox.com to get details on the gamertag but i am new to the javascript language. Has anyone done a script for anything like this or know where i can find one. Ive tried googling etc for one and tried it for myself but i aint getting no where, let alone know if what ive tried scripting even exsists.
So I feel like I should just explain what I am looking to do. Lets say there is an Item that has the number 001234-A1. This Number is the exact number that the manufacturer lists it is, however whenever it gets placed into other catalogs or websites the item number changes slightly for example:
12-34a1
0001234A1
1-234-A1
123-4a1
So what I would like to have someone show me how to do it write a script that can do three things
Remove all leading zero's
Remove all hyphens
Make all letters uppercase.
This way we now have a normalized number (1234A1). So to recap I need to create a string that takes any different numbers, normalizes those numbers, and then matches them with all other matching numbers. I really would appreciate some assistance in this. Thank You, Thank You I am in a basic computer science class. I have to do a simple javascript project, but some of the code isn't working. The popup works, but the button does not appear, and I cannot get my rollover image to appear. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <h1>Money</h1> <script> function checkAGE(){if (!confirm ("Are you sure you want to enter? (<-- You can say whatever you want.)")) history.go(-1);return " "} document.writeln(checkAGE()) </script> <script type="text/javascript"> <p>If you want to make Green, then you need to see Green!</p> <FORM> <INPUT type="button" value="Change to Green!" name="button3" onClick="document.bgColor='green'"> <br> </FORM> Rollimage = new Array() Rollimage[0]= new Image(121,153) Rollimage[0].src = "http://news-libraries.mit.edu/blog/wp-content/uploads/2008/01/money.jpg" Rollimage[1] = new Image(121,153) Rollimage[1].src = "http://encefalus.com/wp-content/uploads/2008/09/resources_money.jpg" function SwapOut(){ document.Rupert.src = Rollimage[1].src; return true; } function SwapBack(){ document.Rupert.src = Rollimage[0].src; return true; } // - stop hiding --> </SCRIPT> </HEAD> <BODY BGCOLOR="#FFFFFF"> <P align="center"> <A HREF="http://www.joemaller.com/" onmouseover="SwapOut()" onmouseout="SwapBack()"> <IMG SRC="joe_open.jpg" NAME="Rupert" WIDTH=121 HEIGHT=153 BORDER=0> </A> </P> </body> </html> I have a javascript program I'm trying to write for an introductory javascript class. The book is absolutely terrible and I've found I have a very weak grasp of how javascript functions work but I have an exam coming up and I'm getting desperate for help so I'm posting here hoping someone can help me get my head wrapped around this thing. The code is a simplified game of 21. It should randomly generate two cards for the dealer and two for the player, then display the total to the player and allow them to choose whether or not to take another card. It then decides who won. I'm including the script below: Code: <script type="text/javascript"> /*Declare Variables*/ var dealer = 0; var player = 0; var dealerPoints = 0; var playerPoints = 0; var rNum = 0; var rPlayer1 = 0; var rPlayer2 = 0; var rDealer1 = 0; var rDealer2 = 0; var hitMe = " "; function playGame() { while((playerPoints < 200) && (dealerPoints < 200)) { /*Generate 2 random numbers between 2 and 11 for the player*/ rPlayer1 = Math.floor((Math.random() * 10 + 2)) rPlayer2 = Math.floor((Math.random() * 10 + 2)) rDealer1 = Math.floor((Math.random() * 10 + 2)) rDealer2 = Math.floor((Math.random() * 10 + 2)) /* Find Players Total*/ player = (rPlayer1 + rPlayer2); /* Find Dealers Total*/ dealer = (rDealer1 + rDealer2); /*Display player total*/ while ((player <= 21) && (dealer <= 21)) { hitme = prompt("You drew a " + rPlayer1 + " card and a " + rPlayer2 + " card for a total of " + player + ". Do you want another card?"); if (hitMe == "yes") { rPlayer1 = Math.floor((Math.random() * 10 + 2)); player = (player + rPlayer1); alert("You drew a " + rPlayer1 + " card for a total of " + player + "."); } if ((player <= 21) && (dealer > 21)) { playerPoints = (playerPoints + player); alert("Player Wins Hand"); } if ((dealer <= 21) && (player > 21)) { dealerPoints = (dealerPoints + dealer); alert("Dealer Wins Hand"); } if ((dealer > 21) && (player > 21)) alert("Tie, no points awarded"); } if ((dealer <= 21) && (player <= 21)) { if (dealer > player) { dealerPoints = (dealerPoints + dealer); alert("Player total: " + playerPoints + ". Dealer points: " + dealerPoints + ". Dealer wins this hand."); } else if (player > dealer) { playerPoints = (playerPoints + player); alert("Player total: " + playerPoints + ". Dealer points: " + dealerPoints + ". Player wins this hand!"); } else { alert("Player total: " + playerPoints + ". Dealer points: " + dealerPoints + ". No one wins this hand."); } if (playerPoints >= 200) { alert("Player wins game!"); } else if (dealerPoints >= 200) { alert("Dealer wins game!"); } } } } </script> Hey, I have a drop down box that selects a project name. This is then taken to a javascript function that is supposed to fill in a read-only box with that name, but instead of filling it in with the project name, it fills it in with the project ID, which is how the sql database is set up. Each project has an ID, a name, and other values. Is there a way I can get the project name given the project ID in the javascript function?
Hi Peers, i have a Drop down list with 10 choices (skillset). users must choose one skillset and the corresponding level (beginer/intermediate/master). ( they have to do this 10 times for all the sillsets) what i want is : 1 - i need to show up only one record (dropdowanlist) with level then have a button to add new skill and level if required 2- then when they choose the 1st skill from the dropdown , this one will not show up on the 2nd choice dropdown. is it possible any help ? thanks guys Hello, If JavaScript is disabled, does the content in an iframe become un-viewable/ blocked? This is in general, regardless of how safe or trusted the website/ content is. Code: <html> <head> <noscript>Javascript is disabled. Having it enabled provides the greatest functionality.</noscript> </head> <body> <noscript>Javascript is disabled. Having it enabled provides the greatest functionality.</noscript> <iframe src="first.html" width="300" height="300" /> </body> </html> Hello I'm having a little trouble. So far I've been able to achieve that when the user clicks on a button, they're be redirected to a random url. (this is from a list of different urls) I can't get it to work so when the user clicks on the button, they're be directed to the url through an iframe and not just loading a new page. I'm awful at explaining things so I donno if you's will understand me! index.html Code: <form name="myForm" id="myForm"> <p> <input type="button" name="myButton" value="url" onclick="rand_link()" /> ................ <iframe id="frame" src="iframe.html" width="100%" frameborder="0" marginheight="0" marginwidth="0"></iframe> ........ url.js Code: function go_to(url) { window.location=url; } function rand_link() { var a; a = 1+Math.round(Math.random()*2); if (a==1) go_to("http://google.com"); if (a==2) go_to("http://ask.com"); } Thanks! I have a parent web page that uses a include file 'leftbar.html' as the left navigation. The parent page has a iframe and here is the code: Code: <iframe src="google.com" style="width: 100%; height: 500px" scrolling="yes" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0"></iframe> Here is the code for each naviagation link on the left nav bar: Code: <tr> <td id="tdIndex" onmouseout="javascript:DoMouseOut(this)" onmouseover="javascript:DoMouseOver(this)" class="menuDefault" onclick="javascript:NavPage('All_Rooms_Today.html');">All Rooms Overview</td></tr> I want the onclick="javascript:NavPage to change the iframe which is currently google.com to a specific page. in this example it would all_rooms_today.html. So I need to write the javascript function Navpage that fills the iframe named internal. Thanks Hello - I need help adding the src in iframe tags. the problem to resolve looks like this: <script type="text/javascript"> /* Display the daily schedule in an inline frame. Daily schedules are stored in the files sunday.htm through saturday.htm. */ document.write("<iframe src ='weekday.htm'></iframe>") </script> Instructions say where weekday is the text string returned by the weekDay() function. I do have weekDay() function but I don't know how to include it into the iframe. Hello, I would like to know which statement I should use in order to echo an iframe in JS. Thanks, Ben Hello Coding Forums, For the past few days, i have been learning and just surfing the forum board. I have recently ran into a problem and i am in need of help. This is a mixture of HTMl, XML, and JavaScript. For what i know, it seems my problem is a JS problem. I have been looking at this Facebook Fan page: http://www.facebook.com/pages/The-fi...18916928166010 I understand everything in the second page. The problem is i dont understand how in page 1, you are direct to page 2. Can anyone please explain to me how this is working? I am new with javaScript. Trust me, i have looked and i am still learning. This is important to me. -Mygel hi, Guys can u help me currently iam running clicksor ads on my blog but its decrease page load time and page stuck where javascrip is located can u help me . how can i put this javascript in iframe so that this javascript loads but never stuck the page thanx Regards Fawad I am trying to run javascript within Iframe and its not running. (The bigger pictu The final target is to do a file upload without refreshing the page, and the original code is using the iframe as the target of the form, and the return from the server is a javascript code that should update some status field on the page. However the code return from the server is not running, so I just paste it in the iframe and it is still not running. ) Code: Content-type: text/html\n\n <html> <script type="text/javascript"> alert("this is running") </script> <iframe id="upload_target" name="upload_target" src="#" style="width:100;height:100;border:0px solid #fff;"> <script type="text/javascript"> alert("this not running") </script> </iframe> </html> I am having trouble with javascript code that is inside an iframe. I am trying to simulate the w3School's tryit. I have tried setting the content of the iframe two different ways and got two different results. This is example code for what I want the iframe's content to be <html> <head> <script type="text/javascript"> function coordinates(event) { x=event.screenX; y=event.screenY; alert("X=" x " Y=" y); } </script> </head> <body onmousedown="coordinates(event)"> <p> Click somewhere in the document. An alert box will alert the x and y coordinates of the cursor, relative to the screen. </p> </body> </html> The first way which was successful (but not what i want) is to save the example code as example.html and set the src property of the iframe to that document. Everything works fine including the mouseEvent. The second way displays the example.html in the iframe as it should but it seems to be ignoring the javascript. This is how I set the iframe content: I have the code stored in a database table. I use xmlHTTPRequest to bring grab the code and it is stored in a variable called responseText. Frome here I the following code sets the iframe content. r = document.getElementById("iframe"); Doc = r.contentWindow || r.contentDocument; if(Doc.document){ Doc = Doc.document; Doc.open(); Doc.write(responseText); Doc.close(); alert(Doc.documentElement.innerHTML); } If anyone can can help me understand why the javascript code doesn't work the second way I would greatly appreciate it. Hi, new to the forum (and Javascript coding). I hope someone can help as this is driving me nuts... I want my website to display the content of another webpage in an iframe. the other webpage extension will change each day (e.g. 'www.example.com/16_02_2012.html' would be today's file to view, 'www.example.com/15_02_2012.html' would have been yesterday's etc.). I have worked out some code to grab today's date and create the web address as a variable. how do i then use that variable in the <iframe src="??"> when someone click a link to "update the iframe"? Here is my code so far... I would really appreciate some help!!! :s <html> <script> function getMonth() { var now = new Date(); var month = now.getMonth(); return month < 10 ? "0" + (month+1) : month+1; } function getDay() { var now = new Date(); var day = now.getDate(); return day < 10 ? "0" + (day) : day; } var month = getMonth(); var day = getDay(); var year=new Date(); var address = "http://www.example.com/" + day + "_" + month + "_" + year.getFullYear() + ".html"; function iFrameWrite(id, url){ document.getElementById(id).src = url; } </script> <iframe id="info" width="800px" height="800px"></iframe><br /> <a href="#" onclick="javascript:iFrameWrite('info', 'address')">Update the Iframe</a> </html> Hi All, I have html pages with code like <div> <script type="text/javascript" src="http://myserver2/mysite/addhtm.js"></script> </div> the script adds some html code and random images selected from second server inside an iframe tag in the div tag. I need to examine this added html and image properties in my page using javascript. A search on internet did not help, it says elements inside iframe coming from different domain can not be accessed. Is there any workaround or hack available to access iframe contents from page javascript? Thanks Hello! I have a script that loads a popup window on any page of a website, in order to temporarily cover the page's content. This popup window is supposed to load on top of page's content, acting as a sort of page blocker. So the visitor can't see what's on the page until he clicks the popup. The problem i'm having right now is when i put this script on a page that has iframe content. The iframe loads on top of this popup and not underneath as it's supposed to be. Do you guys have any advise on what should i do to make this work properly when using iframes on a page? Here is the script: Code: var blocker_originalHtmlOverflow; var blocker_originalBodyOverflow; function blocker_addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } blocker_addLoadEvent(blocker_init); function blocker_init() { if(blocker_getCookie('content_unlocked')=='1') return; blocker_originalHtmlOverflow = document.getElementsByTagName('body')[0].style.overflow; blocker_originalBodyOverflow = document.getElementsByTagName('html')[0].style.overflow; document.getElementsByTagName('body')[0].style.overflow = 'hidden'; document.getElementsByTagName('html')[0].style.overflow = 'hidden'; function pageScroll() { window.scroll(0,0); // scroll to 0 if(blocker_getCookie('content_unlocked')!='1'){ scrolldelay = setTimeout('pageScroll()',100); // scrolls every 1 second } } pageScroll(); var haze = document.createElement('div'); haze.id = 'blocker_haze'; haze.style.filter = 'alpha(opacity=50)'; haze.style.opacity = .5; haze.style.height = '2000'; haze.style.width = '2000%'; haze.style.backgroundColor = '#000'; haze.style.position = 'absolute'; haze.style.top = '0px'; haze.style.left = '0px'; haze.style.zIndex = 1000000; var centerPane = document.createElement('centerPane'); centerPane.id = 'blocker_centerPane'; centerPane.style.width = '500px'; centerPane.style.height = '361px'; centerPane.style.border = '5px solid #CCC'; centerPane.style.position = 'absolute'; centerPane.style.left = '50%'; centerPane.style.marginLeft = '-250px'; centerPane.style.top= '100px'; centerPane.style.backgroundColor = '#FFF'; centerPane.style.zIndex = 1000001; centerPane.style.backgroundImage = 'url(http://www.fasgasfga.com/sfasdfasdf.jpg)'; centerPane.style.backgroundRepeat = 'no-repeat'; centerPane.style.backgroundPosition = '20px 10px'; centerPane.style.padding = '20px'; var h1 = document.createElement('h1'); h1.style.color = '#000'; h1.style.textAlign = 'center'; h1.style.fontSize = '36px'; h1.style.margin = '0 0 10px 0'; h1.style.padding = '8px 0 0 15px'; h1.style.fontFamily = 'arial'; h1.style.lineHeight = '36px'; h1.innerHTML = blocker_headline; centerPane.appendChild(h1); var p1 = document.createElement('p'); p1.innerHTML = blocker_instructionalText; p1.style.textAlign = 'center'; p1.style.padding = '20px 0 20px 0'; p1.style.margin = '0'; p1.style.fontSize = '18px'; p1.style.lineHeight = '18px'; p1.style.color = '#000'; p1.style.fontFamily = 'arial'; centerPane.appendChild(p1); var ul = document.createElement('ul'); ul.style.textAlign = 'center'; ul.style.margin = '0 0 10px 0'; ul.style.padding = '0'; ul.style.listStyleType = 'none'; for(var i = 0;i<blocker_surveryLinks.length;i++){ var li = document.createElement('li'); var a = document.createElement('a'); a.style.display = 'block'; a.style.fontSize = '17px'; a.style.lineHeight = '380px'; a.style.color = 'Black'; a.style.fontFamily = 'arial'; a.style.textDecoration = 'underline'; a.target = '_blank'; a.href = blocker_surveryLinks[i].url; a.innerHTML = blocker_surveryLinks[i].text; a.onclick = function(){ window.setTimeout(unblockContent, 55000); } li.appendChild(a) ul.appendChild(li); } centerPane.appendChild(ul); var p2 = document.createElement('p'); p2.style.textAlign = 'center'; p2.innerHTML = blocker_footerText; p2.style.padding = '20px 0 0 0'; p2.style.margin = '0'; p2.style.color = '#F50E0E'; p2.style.fontFamily = 'arial'; p2.style.fontSize = '15px'; p2.style.lineHeight = '15px'; centerPane.appendChild(p2); document.getElementsByTagName('body')[0].appendChild(haze); document.getElementsByTagName('body')[0].appendChild(centerPane); } function unblockContent(){ document.getElementsByTagName('body')[0].style.overflow = blocker_originalBodyOverflow; document.getElementsByTagName('html')[0].style.overflow = blocker_originalHtmlOverflow; document.getElementById('blocker_haze').style.display = 'none'; document.getElementById('blocker_centerPane').style.display = 'none'; //blocker_setCookie("content_unlocked", 1, 365, '/', ''); Set_Cookie( 'content_unlocked', 1 , 365, '/', '', '' ); } function Set_Cookie( name, value, expires, path, domain, secure ) { // set time, it's in milliseconds var today = new Date(); today.setTime( today.getTime() ); /* if the expires variable is set, make the correct expires time, the current script below will set it for x number of days, to make it for hours, delete * 24, for minutes, delete * 60 * 24 */ if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date( today.getTime() + (expires) ); document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } function blocker_setCookie(c_name,value,expiredays){ var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } function blocker_getCookie(c_name){ if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1){ c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } |