JavaScript - Images Not Displayed Using Js
Hi, I tried displaying few images as MENU using Javascript. These images are showed normally in Firefox and chrome except Internet Explorer. Help plz
Similar TutorialsHello. I have a <div> html element which contains other html tags, as well as plain text inside those tags. How do I grab only the content within the div that will actually be displayed in the browser, and put it in a Javascript string variable? Thanks in advance. Can anyonle pls explain me why the return function is not returning the result as intended? I appreciate you help OUTPUT ====== Student : Doe,John eMail : johndoe@gmail.com Course ID : COIN-070B.01 -------------------------------- function task() { var title = ["Assignment1", "Assignment2", "Assignment3", "Assignment4", "Assignment5", "Mid Term", "Finals"]; var points = [30, 30, 28, 27, 29, 41, 45]; for (var i = 0; i < points.length; i++) { titlePoints += title[i] + (" : " + points[i] + "\n"); } return titlePoints; } Code: <head> <title>Variable - Examples 1</title> <script type="text/javascript"> function Student(firstName, lastName, email,courseID){ this.firstName = firstName; this.lastName = lastName; this.email = email; this.courseID = courseID; this.assignments = task; } Student.prototype = { constructor : Student, toString : studentInfo }; function task(){ var title = ["Assignment1","Assignment2","Assignment3","Assignment4","Assignment5","Mid Term", "Finals"] var points = [30, 30, 28, 27, 29,41,45]; var titlePoints = ""; for (var i=0; i < points.length; i++){ titlePoints += title[i] + " : " + points[i] + "\n"; } return titlePoints; } function studentInfo(){ return "Student : " + this.lastName + "," + this.firstName + "<br>"+ "eMail : " + this.email + "<br>" + "Course ID : " + this.courseID + "<br>" + "--------------------------------" + "<br>" + this.assignments; } var student = new Student("John", "Doe", "johndoe@gmail.com","COIN-070B.01"); </script> </head> <body> <script type="text/javascript"> document.writeln(student.toString()); </script> </body> </html> Hello everyone! Hi, I am a complete beginner at Javascript(started a few days ago) and was having trouble with some functions. I'm trying to get the inputs required to change based on an option selected in a drop down menu. I was intending to run different scripts based on whatever is chosen but when I ran a test using an alert function, I realized my code isn't working. I went online and found really confusing stuff like "running a for loop through an array to make a dynamic select feature". Still confused any help would be appreciated. My code thus far: Code: <html> <head> <title>Practice</title> <script language="javascript"> function myScript() { var loanType = document.form1.loan.options.text if (loanType == "Bank A") { alert("Working") } } </script> </head> <body> <form name="form1"> <select id="loan" name="loan" onchange="myScript"> <option></option> <option>Bank A</option> <Option>Bank B</Option> </select> </form> </body> </html> Reply With Quote 01-29-2015, 12:02 PM #2 vwphillips View Profile View Forum Posts Visit Homepage Senior Coder Join Date Mar 2005 Location Portsmouth UK Posts 4,540 Thanks 3 Thanked 513 Times in 500 Posts Code: <html> <head> <title>Practice</title> <script language="javascript"> function myScript() { var s=document.form1.loan,loanType = s.options[s.selectedIndex].text if (loanType == "Bank A") { alert("Working") } } </script> </head> <body> <form name="form1"> <select id="loan" name="loan" onchange="myScript();"> <option></option> <option>Bank A</option> <Option>Bank B</Option> </select> </form> </body> </html> or better Code: <html> <head> <title>Practice</title> <script language="javascript"> function myScript(s) { if (s.value == "Bank A") { alert("Working") } } </script> </head> <body> <form name="form1"> <select id="loan" name="loan" onchange="myScript(this);"> <option></option> <option value="Bank A" >Bank A</option> <Option value="Bank B">Bank B</Option> </select> </form> </body> </html> Code: function my_fav_quote_show_optin_form() { if (!empty($_POST['my_fav_quote_email'])) { my_fav_quote_opt_in(); } $out2 = ''; $out = '<form action="" name="myform "method="post" id="requestQuote">'; $out .= '<table style="padding="0px" width="40px">'; $out .= '<tr><td>Name:*</td><td><input type="text" name="my_fav_quote_name" id="my_fav_quote_name"/></td></tr>'; $out .= ''; $out .= '<tr><td>Email:*</td><td><input type="text" name="my_fav_quote_email" id="my_fav_quote_email"/></td></tr>'; $out .= ''; $out .= '<tr><td>Phone:*</td><td><input type="text" name="my_fav_quote_phone" id="my_fav_quote_phone"/></td></tr>'; $out .= ''; $out .= '<tr><td>Event Date(optional):</td><td><input type="text" name="my_fav_quote_date" id="my_fav_quote_date"/></td></tr>'; $out .= ''; $out .= '<tr><td>Estimated Number of Guests(optional):</td><td><input type="text" name="my_fav_quote_guest" id="my_fav_quote_guest"/></td></tr>'; $out .= ''; $out .= '<tr><td>Desired Price Range Per Person (optional):</td><td><input type="text" name="my_fav_quote_rate" id="my_fav_quote_rate"/></td></tr>'; $out .= ''; $out .= '<tr><td style="vertical-align: middle;">Message:<br>(List your special requests, any food allergies , event description , special menu items that are not listed or any other information you think will helpful) </td><td><textarea placeholder="" name="my_fav_quote_message" id="my_fav_quote_message"></textarea></td></tr>'; $out .= ''; $out .= '<tr><td>Security code:*</td><td><img src='.get_bloginfo('wpurl').'/wp-content/plugins/quote-cart/captcha.php?width=60&height=30&characters=5" /></td></tr>'; $out .= ''; $out .= '<tr><td>Input Above Security Code He *</td><td><input type="text" name="security_code" id="security_code" size="5"></td></tr>'; $out .= ''; $out .='<tr><td colspan="2">'; if ( function_exists( 'my_fav_quote_display' ) ){ $out .= my_fav_quote_display(); } if ( function_exists( 'my_fav_quote_display3' ) ){ $out .= my_fav_quote_display3(); } $out .='</td></tr>'; $out .= '<tr><td colspan=2 align=center><input type="submit" value="Request Quote" onclick="return chk_validation()" style="background-color:#000;color:#FFF;padding:5px;margin-top:10px;border:none;cursor:pointer;"/> <input type="button" onclick="formReset()" value="Reset form" /> </td></tr>'; $out .='</table></form>'; echo $out; ?> <script language="javascript" type="text/javascript"> //<![CDATA[ function validate_email(field,alerttxt) { apos=field.indexOf("@"); // alert(apos); dotpos=field.lastIndexOf("."); //alert(dotpos); if (apos<1||dotpos-apos<2) { return false;} else {return true;} } function chk_validation() { if(document.getElementById("my_fav_quote_name") && document.getElementById("my_fav_quote_name").value == '') { alert("Please Enter Name"); document.getElementById("my_fav_quote_name").focus(); return false; } if(document.getElementById("my_fav_quote_email").value == '') { alert("Please Enter Email"); document.getElementById("my_fav_quote_email").focus(); return false; } else { //alert(validate_email(document.getElementById("my_fav_quote_email").value,"Not a valid e-mail address!"); if (validate_email(document.getElementById("my_fav_quote_email").value,"Please enter valid e-mail address!")==false) { alert("Please enter valid e-mail address!"); document.getElementById("my_fav_quote_email").focus(); return false; } } if(document.getElementById("security_code").value == '') { alert("Please Enter Security Code"); document.getElementById("security_code").focus(); return false; } if(document.getElementById("quotes").value == '') { alert("Please add atleast one request quote"); document.getElementById("quotes").focus(); return false; } //return true; } //]]> </script> <?php } can we reset the display functions data when we click on reset button? I need a java script code that can be installed in to my chrome (plugin) but all it will do is. Code: If (code) is display quite current tab. else if code isnt displayed leave tab open. The code would the zip code that is filled in on a page like this. http://www.locationary.com/place/en/...1023990998.jsp to see the code properly you need to sign in to the site (free sign up takes like 2 seconds) so if zip code is filled in then quit tab please any help on this would be great Hi, I am a complete beginner at Javascript(started a few days ago) and was having trouble with some functions. I'm trying to get the inputs required to change based on an option selected in a drop down menu. I was intending to run different scripts based on whatever is chosen but when I ran a test using an alert function, I realized my code isn't working. I went online and found really confusing stuff like "running a for loop through an array to make a dynamic select feature". Still confused any help would be appreciated. My code thus far: <html> <head> <title>Practice</title> <script language="javascript"> function myScript() { var loanType = document.form1.loan.options.text if (loanType == "Bank A") { alert("Working") } } </script> </head> <body> <form name="form1"> <select id="loan" name="loan" onchange="myScript"> <option></option> <option>Bank A</option> <Option>Bank B</Option> </select> </form> </body> </html> Reply With Quote 01-08-2015, 10:52 AM #2 Primus View Profile View Forum Posts New Coder Join Date Oct 2014 Posts 92 Thanks 0 Thanked 14 Times in 14 Posts Code: <script> function myScript() { var selectedIndex = document.form1.elements.loan.options.selectedIndex; // returns 0-2 in this case var loanType = document.form1.elements.loan.options[selectedIndex].value; // returns the value of the selected item if (loanType == "Bank A") { alert("Working") } } </script> <form name="form1"> <select id="loan" name="loan" onchange="myScript()"> <option></option> <option>Bank A</option> <option>Bank B</option> </select> </form> Maybe not the best way, but it does the trick. Reply With Quote 01-08-2015, 11:43 AM #3 Philip M View Profile View Forum Posts Supreme Master coder! Join Date Jun 2002 Location London, England Posts 18,371 Thanks 204 Thanked 2,573 Times in 2,551 Posts You have quite a lot of obsolete code:- 1) It is obsolete to assign a name to a form and permitted only for the sake of backwards compatibility. 2) <script language=javascript> is long deprecated and obsolete. Use <script type = "text/javascript"> instead (in fact also deprecated but still necessary for IE<9). 3) Scripts should normally be placed right in front of the </body> tag. Any script can optionally go in the head if you wrap it inside a load event listener so that it can't run before the page loads. 4) Use the value of a select box option, not the text. 5) It is recommended that you place the opening brace following the function, if, else, for, while, do, switch, and try statements on the same line and not on the following line. Apart from that every Javascript statement should be followed by a semi-colon (;). It is quite possible to disregard this advice, but if you do one day it will rise up and bite you in the undercarriage. Code: <html> <head> <title>Practice</title> </head> <body> <form> <select id="loan" name="loan" onchange="myScript()"> <option value = "">Chosoe...</option> <option value = "Bank A">Bank A</option> <Option value = "Bank B">Bank B</Option> </select> </form> <script type = "text/javascript"> function myScript() { var loanType = document.getElementById("loan").value; if (loanType == "Bank A") { alert("Working") } } </script> </body> </html> If you really want to use the option text ... Code: <html> <head> <title>Practice</title> </head> <body> <form> <select id="loan" name="loan" onchange="myScript(this)"> <option value = "">Choose...</option> <option value = "Bank A">Bank A</option> <Option value = "Bank B">Bank B</Option> </select> </form> <script type = "text/javascript"> function myScript(element) { var loanType = element.options[ element.selectedIndex ].text; if (loanType == "Bank A") { alert("Working") } } </script> </body> </html> The Warrington players can hang their heads high. - Commentator, BBC Radio 2 Good Day, I am very new to JavaScript and I am working on an assignment that is almost finished, but I have a problem getting the result to work. When I enter the two values and then hit submit, nothing is returned. I am guessing that either my code is incorrect or I have used the wrong ids maybe. Basically, the user enters 2 parameters (hourly wage and hours worked) and the first function turns the parameters into the gross pay (depends on if the hours are standard pay or if overtime is involved). The second function takes the gross pay and does the tax amounts for local, state and federal. Then it adds all taxes to give a total of tax amount paid. The input for the parameters is done by <input> tag. The return reslut is supposed to be just the number which is the total amount of taxes to be taken out. This all has to be done by <input> tags. Could someone look over the html and JS and help me find where the problem is at. The instructor said we could use ? : operator for determining the pay rates, but I found it easier to do if/else staements because I was not sure how you would script that. Any help would be great. Thanks HTML Code Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Calculate Tax Amount</title> <link href="style.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="calculateGross.js"></script> <script type="text/javascript" src="calculateTax.js"></script> </head> <body> <table width="60%" border="0" cellpadding="0" cellspacing="2" align="center" class="view"> <tr> <td colspan="3" class="textview">Calculate the gross pay:</td> </tr> <tr> <td class="labeltext">Pay rate(dollars per hour)</td> <td>:</td> <td><input type="text" name="payrate" id="payrate" class="textval"></td> </tr> <tr> <td class="labeltext">Hours worked</td> <td>:</td> <td><input type="text" name="hours" id="hours" class="textval"></td> </tr> <tr> <td colspan="3" align="center"><input type="button" name="" value="Submit" onclick="return calculate(); "> </td> </tr> </table> <br> <br> <table width="60%" border="0" cellpadding="0" cellspacing="2" align="center" class="view"> <tr> <td colspan="3" class="textview">Total Tax Paid:</td> <tr> </tr> <td class="labeltext">Grand Total of Taxes</td> <td>:</td> <td><input type="text" name="total" id="totalTax" class="textval" disabled="disabled"></td> </tr> </table> </body> </html> First Function JS Code: function calculate() { var payRate = document.getElementById("payrate").value; var hoursWorked = document.getElementById("hours").value; var oTime; var oPay; var oHour; var grossPay; if(hoursWorked > 40) { oTime = Number ( hoursWorked ) - 40; oPay = Number ( ( payRate ) * 1.5 ) * oTime; oHour = Number ( hoursWorked )- Number ( oTime ); grossPay = Number ( payRate ) * Number ( oHour ) + Number ( oPay ); } else grossPay = Number ( hoursWorked ) * Number ( payRate ); } The second function JS Code: function calculateTax(gross) { var gross; var localTax; var localTaxBal; var stateTax; var stateTaxBal; var fedTax; var fedTaxBal; var totalTax; localTax = Number ( gross ) * 2/100; localTaxBal = Number ( gross ) - Number ( localTax ); stateTax = Number ( localTaxBal ) * 8/100; stateTaxBal = Number ( localTaxBal ) - Number ( stateTax ); fedTax = Number ( stateTaxBal ) * 31/100; fedTaxBal = Number ( stateTaxBal ) - Number ( FedTax ); totalTax = Number ( localTax.toFixed(2) ) + Number ( stateTax.toFixed(2) ) + Number ( fedTax.toFixed(2) ); return totalTax.toFixed(2); } Hello, I am fairly new to javascript so patience is appreciated. I have some javascript I need to execute that is located in an SSI footer. The purpose of the code is to find out what domain the page was loaded at and then to tailor some links to match. Because of how the hosting environment is set up (which I have no control over) when the links don't match the domain they aren't included. I also have to use a complete url (as opposed to relative url) because the footer is included in many different web pages. The problem is that the code is executed but it also is displayed as plain text in firefox. The test site is http://test.ci.edina.mn.us Help! The code is: Code: <script type="text/javascript"> var domainName, strOut; domainName = document.domain; strOut = '<link rel="stylesheet" type="text/css" href="http://' + domainName + '/js/jquery.fancybox/jquery.fancybox.css" media="screen" />'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery-1.3.2.min.js" type="text/javascript"></script>'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery.fancybox/jquery.fancybox-1.2.1.js" type="text/javascript"></script>'; document.write(strOut); strOut = '<script src="http://' + domainName + '/js/jquery.easing.1.3.js" type="text/javascript"></script>'; document.write(strOut); </script> Hi, I am new to this forum but I am in dire need of help. I am sorry if this isn't they way you normally do things. I read through some of the rules, but it is late and I am in a hurry. Any help would be greatly appreciated. I need the image file names in my array to be shown in the text box. I am not quite sure how to do this. I have been trying for some time but cannot figure it out. Here is my code. <head> <title>Asn4CStartup.htm by Todd Bowman</title> <style type="text/css" > h1, h2, h3 {font-family: 'arial black';} .controls { font-family: 'arial black'; font-size:10pt;} </style> <script type="text/javascript"> /* <![CDATA[ */ // Note: variables declared inside a function // using the var keyword are all local variables. It means that these // variables are only known inside the function. Other functions cannot see // the values. // On the other hand if a variable is declared outside any function, these are global // variables. The values of global variables are available in all other functions. // Other function can change the values of global variables. // Declare a global var n: var n=0; // we will use this global variable to keep track of exactly which element of the array // is being displayed now. When the user clicks Next button, we will add 1 to n and // then display the image file in the nth element of the array // Declare a global array that will contain the names of image files. var imgArray = new Array(); // The following function will be triggered on the onload event of the page. function fillArray() { // alert ("Hello on load"); imgArray[0]="Bus1.jpg"; imgArray[1]="Bus2.jpg"; imgArray[2]="Fam1.jpg"; imgArray[3]="Fam2.jpg"; imgArray[4]="Honey1.jpg"; imgArray[5]="Honey2.jpg"; imgArray[6]="Map1.png"; // for ( i in imgArray) // alert (imgArray[i]); } function showNext() // This function will be triggered on click of the Next button { // alert ("Hello showNext"); // alert(n); n = n+1; //alert (n); if (n > imgArray.length-1) { alert ('You are already on the last image'); n = n-1; } else document.getElementById('imgPic').src='images/'+imgArray[n]; } // end showNext() function showPrevious() // This function will be triggered on click of the Previous button { // alert("Hello Previous"); // alert(n); n = n-1; // alert (n); if (n < 0) { alert ('You are already at the first image'); n = n+1; } else document.getElementById('imgPic').src='images/'+imgArray[n]; } // end showPrevious() function showFirst() //This function will be triggered on click of the First button { // alert (n); if (n == 0) { alert ('You are already on the first image'); } else document.getElementById('imgPic').src='images/'+imgArray[0]; } function showLast() { // alert (n); if (n > imgArray.length-1) { alert ('You are already on the last image'); } else document.getElementById('imgPic').src='images/'+imgArray.length-1; } /* ]]> */ </script> </head> <body onload="fillArray();"> <div> <h1> Asn4CStartup.htm by Mesbah Ahmed </h1> <h2>Windsurf Image Navigation </h2> Name of the image file shown below:   <input type="text" id="imageName" size="20" readonly="readonly" /> <br/><br/> <img id="imgPic" src = "images/Bus1.jpg" alt="picture" width="500px" height="350px" /> <br/> <input type="button" value="Next" class="controls" onclick="showNext();" /> <input type="button" value="Previous" class="controls" onclick="showPrevious();" /> <input type="button" value="First" class="controls" onclick="showFirst();" /> <input type="button" value="Last" class="controls" onclick="showLast();" /> <br/> <p> <img src="http://www.w3.org/Icons/valid-xhtml11.png" alt="Valid XHTML 1.1!" height="31px" width="88px" /> <img src="http://jigsaw.w3.org/css-validator/images/vcss-blue.png" alt="Valid CSS!" height="31px" width="88px" /> </p> </div> </body> </html> Working on an Adobe form (non web) The "Award" field is a bit troublesome. Award is not required every time therefore I left that out of it's field properties. I have also set the maxium amount of characters to 5. At times, it will be required therefore I want to set up validation that will return an error message if 1-3 characters are filled in but won't give any error message if 4 or 5 characters are entered in the field. I.e 0= Do nothing 1= Error 2= Error 3= Error 4= Do nothing 5= Do nothing Code: if ((event.value.length > 1) && (event.value.length < 4)) //trigger alert if 1-3 characters are entered { app.alert("The minimum amount of characters is 4"); event.rc = false; } else { // do nothing if 0,4 or 5 characters are entered } Hi, I'm trying to code a script that will display an approximate postage price based on different combinations of variables, but the numbers I defined for each case aren't reflected in the text box. I'm using a switch statement for all the different combinations of options, which the user will choose by selecting check-boxes. I'd really appreciate if anyone could point out where I'm going wrong. (Additionally, I know that this code probably isn't a very efficient way of doing what I'm doing - I'm open to suggestions on how to improve it.) I've attached all the relevant parts of the code, including how I defined variables originally. Many thanks in advance, Gil Code: <script type="text/javascript"> function count() { var firstclass = document.calc.firstclass.value; var postcard = document.calc.firstclass.value; var numpages = document.calc.numpages.value; var nms = document.calc.nms.value; var large = document.calc.large.value; var numpages = parseInt(document.calc.numpages.value); if (document.calc.grabber.checked) { var vweight = (numpages + 8) * 0.17636981; } else { var vweight = numpages * 0.17636981; } var postageprice = 0; switch(postageprice) { case document.calc.postcard.checked: var postageprice = 28; break; case document.calc.firstclass.checked && vweight <= 1: var postageprice = 44; break; case document.calc.firstclass.checked && vweight <= 2: var postageprice = 61; break; case document.calc.firstclass.checked && vweight <= 3: var postageprice = 78; break; case document.calc.firstclass.checked && vweight <=3.5: var postageprice = 95; break; case document.calc.firstclass.checked && document.calc.large.checked && vweight <= 1: var postageprice = 88; break; case document.calc.firstclass.checked && document.calc.large.checked && vweight <= 2: var postageprice = 105; break; case document.calc.firstclass.checked && document.calc.large.checked && vweight <= 3: var postageprice = 122; break; case document.calc.firstclass.checked && document.calc.large.checked && vweight <= 4: var postageprice = 139; break; case document.calc.firstclass.checked && document.calc.nms.checked && vweight <= 1: var postageprice = 64; break; case document.calc.firstclass.checked && document.calc.nms.checked && vweight <= 2: var postageprice = 81; break; case document.calc.firstclass.checked && document.calc.nms.checked && vweight <= 3: var postageprice = 98; break; case document.calc.firstclass.checked && document.calc.nms.checked && vweight <= 3.5: var postageprice = 105; break; case document.calc.firstclass.checked && document.calc.nms.checked && document.calc.large.checked && vweight <= 1: var postageprice = 122; break; case document.calc.firstclass.checked && document.calc.nms.checked && document.calc.large.checked && vweight <= 2: var postageprice = 139; break; case document.calc.firstclass.checked && document.calc.nms.checked && document.calc.large.checked && vweight <= 3: var postageprice = 156; break; case document.calc.firstclass.checked && document.calc.nms.checked && document.calc.large.checked && vweight <= 4: var postageprice = 173; break; default: var postageprice = 0 } document.calc.pay.value = postageprice } </script> <form name="calc" method="POST"> <input type="text" name="numpages" size="10" value=10 onpropertychange="count()" onkeypress="keypress(event)" onclick="SelectAll()"> <input type=button name=clearnumber value="Clear" onclick="document.calc.numpages.value=0"> <p></p> <input type="checkbox" name="firstclass" size="10" onclick="count()"><p> <input type="checkbox" name="large" size="10" onclick="count()"></p> <p> <input type="checkbox" name="nms" size="10" onclick="count()"></p> <p> <input type="checkbox" name="postcard" size="10" onclick="count()"></p> <p> <input type="checkbox" name="grabber" size="10" onclick="count()"></p> <p>$<input type="text" name="pay" size="10"> $<input type="text" name="perthousand" size="10"> </p> </form> Thanks again. I am looking to have the user input a word into a textbox then when the user hits an "Add" button, the word is stored to an array and then is displayed in a table. I also want the textbox to clear after the "Add" button is pressed. Next, I want the user to be able to input another word into the textbox and when the "Add" button is pressed, have that word stored to same array as the first word but just to a different number. e.g. ingredient(0)=first word; ingredient(1)=second word. Then I want the second word to be displayed right below the first word in the table, in the next line down.This is what I have so far. You can also see at http://www.stuffedpantry.com/startsearch.html <code> <html> <head> <title>Stuffed Pantry~Recipe Search (Under Construction)</title> <link rel="stylesheet" type="text/css" href="main.css"> </head> <body> <script type="text/javascript"> var ingredients=new Array(); </script> <div id="lftBar"> </div> <div id="level0"> <div id="level1"> <div id="level3"> <div id="rgtBar"> <script type="text/javascript"><!-- google_ad_client = "pub-1493036398028662"; /* 160x600, created 3/15/10 */ google_ad_slot = "0764917859"; google_ad_width = 160; google_ad_height = 600; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> <div id="topBar"> <img class="displayed" src="logo.jpg"> <div id="advBar"> <p align="center"><font font size="6" color="darkblue"><b><i>A recipe search engine.</i></b></font></p> </div> </div> <div id="level2"> <div id="main"> <p align="center"><font font size="4">Welcome to the search engine of stuffedpantry.com! This page is designed to to help you search our database of recipes to find the perfect recipe for you! So to begin, type in an ingredient. Any ingredient will work! You could put in a type of seasoning, like paprika. Or you can put in a type of soup, like chicken noodle soup! Anything that is considered food will work! And if there isn't a recipe containing the ingredient(s) you have chosen, then submit one to us! You can submit one <a href="recipesubmit.html">here!</font></a> <div id="level4"> <form > <table border="0" cellpadding="0" cellspacing="0" align="center"> <tr><td align="center"><label for="ingredient"><b>Enter Ingredient: </b></label><input type="text" name="ingredient" id="textbox1" style="width:200px;"><div style="clear:left;height:20px;"></div></td><td> <tr><td align="center"><input type="button" value=" Add " onclick="getElementById('ing').innerHTML = getElementById('textbox1').value"></td></tr> <tr><td> </td></tr> <tr><td id="ing"</td></tr> <tr><td> </td></tr> <tr><td align="center"><input type="radio" name="choose" value="only" checked>Search recipes that have <b>ONLY</b> these ingredients<br/><input type="radio" name="choose" value="including">Search recipes that <b>INCLUDE</b> these ingredients</td></tr> <tr><td> </td></tr> <tr><td align="center"><input id="button1" type="submit" value=" Search! "</td></tr> </form> </div> </div> </div> </div> </div> </div> </body> </html> </code> Is it possible to scrape displayed text you can't find in html source code ? The text shows up only when you click a link, but is still not visible in source code. That link has got a userid and is used as a variable in function ShowUserPhone(userid). If someone knows how to solve this mystery, please help. I added http://www.mediafire.com/file/9eo72u...wUserPhone.txt file as available .js source linked to that smart page. I've also put some comments there about URL original location. Here is the main function where the process started I guess: Code: function ShowUserPhone(userid){ var UserPhoneLink=document.getElementById("UserPhoneLink"); var UserPhone = document.getElementById("UserPhone"); if(document.images){ (new Image()).src="/pp-owners-list-click-counter.asp?UserId="+escape(userid)+"&counterType=detailsphone"; } if (UserPhoneLink){ UserPhoneLink.style.display="none"; } if (UserPhone){ UserPhone.style.display="block"; } } Please help. I have an iFrame that is loaded when a user types a url into a text box. Is it possible to display the meta-description of the page that is diplayed in the iFrame in the main (parent) page ? Here is the Iframe code I am using in the body: Code: <iframe src="http://www.mhgoebel.com" frameborder="0" id="frame" width="320" height="356" scrolling="no"> </iframe> and here is the script in the header: Code: <script> function goTo() { var input = get("box").value, frame = get("frame"); if(input.match(/\bhttp(.)*/)) { frame.src = input; } else { input = "http://" + input; frame.src = input; } } function get(id) { return document.getElementById(id); } </script> I'm coding a simple random sentence generator & this is the beginning part of what I'm trying to accomplish. I created 3 different functions with 3 separate buttons & 3 separate text areas to display the noun, verb, or article once the button is pressed. However, when I press a button, nothing shows up in the text area! Can someone please tell me what I'm doing wrong & give me a fix? It has to be a simple problem, but I am very very new to this & need help. Thanks in advance! Code: <?xml version="1.0" encoding="ISO-8859-1"?> <!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> <script language="JavaScript"> function noun() // Assumes: nothing // Returns: a random noun { return RandomOneOf(["man", "woman", "ball"]); } </script> <script language="JavaScript"> function verb() // Assumes: nothing // Returns: a random noun { return RandomOneOf(["hit", "liked", "smelled"]); } </script> <script language="JavaScript"> function article() // Assumes: nothing // Returns: a random noun { return RandomOneOf(["the", "a", "some"]); } </script> </head> <body> <input type="button" value="Noun" onclick="document.getElementById('OutNoun').value = noun();" /> <TEXTAREA ID="OutNoun" ROWS=1 COLS=15 WRAP VALUE=""></TEXTAREA> <input type="button" value="Verb" onclick="document.getElementById('OutVerb').value = verb();" /> <TEXTAREA ID="OutVerb" ROWS=1 COLS=15 WRAP VALUE=""></TEXTAREA> <input type="button" value="Article" onclick="document.getElementById('OutArticle').value = article();" /> <TEXTAREA ID="OutArticle" ROWS=1 COLS=15 WRAP VALUE=""></TEXTAREA> </body> </html> Hello, I'm looking for help as I have the jCarouselLite feature functioning on my website and am looking for a way of displaying another image to the right of the carousel, dependent upon which image is visible in the carousel. I toyed with the idea of implementing another snippet of JavaScript to swap the text to the right and manually synching the swap time wise, but quickly abandoned this idea for a number of reasons, particularly as the carousely has buttons to scroll through the images displaying. I have to admit I'm not particularly great with JavaScript, but was thinking along the lines of another function that listens for the image that is displayed, but have no idea if am way off the mark, or even if this is the right track - no idea how to implement. Any help would be very gratefully recieved. Thanks, Matt hi guys, I need to implement an inline calendar showing multiple months(suppose 6 months) starting from current month in my web application. It should be possible to move to the previous months and next months. Also it should be possible to retrieve the date when a user clicks (onclick event) on a particular date. Is there any javascript source code available? could anyone please help me? thanks in advance Hello, My goal is to show a series of embedded youtube videos on one page but allowing the user to hide or show any youtube video by clicking a button associated with a specific youtube video on the page. I made a form that submits the youtube embed code to a mysql database and I created a php file to retrieve every embed code using a for loop. For each iteration of the for loop, a youtube video will pop up with a corresponding button which will allow the user to hide or show the youtube video. It works when there is only one entry in the mysql table but does not work when more youtube embed codes are uploaded. For example, when there are two youtube embed codes uploaded, two buttons are created, but when I click either of the two buttons, it will only show or hide the first youtube embed. None of the buttons will show the second youtube video. Here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>hide/show iframe</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <style type="text/css"> <!-- #frDocViewer { width:70%; height:50%; display:none; } --> </style> <script type="text/javascript"> <!-- function HideFrame() { var fr = document.getElementById ("frDocViewer"); if(fr.style.display=="block") { fr.style.display="none"; } else { fr.style.display="block"; } } //--> </script> </head> <body> <?php mysql_connect ("","","") or die(mysql_error()); mysql_select_db ("") or die(mysql_error()); $lastid = mysql_query ("SELECT * FROM embed ORDER BY id DESC LIMIT 1"); $lastid = mysql_fetch_assoc($lastid); $lastid = $lastid['id']; for ($count=1; $count<= $lastid ; $count++) { $iframe = mysql_query ("SELECT * FROM embed WHERE id=$count "); $iframe = mysql_fetch_assoc($iframe); $iframe = $iframe['url']; echo " <img src='utube.gif' onclick='HideFrame()' /> <div id='frDocViewer'> $iframe </div> "; } ?> </body> </html> thanks in advance Hello, I'm currently working on http://footytweets.co.uk and would like to add an input field to my twitter feed widgets, which allows users to change which twitter account tweets are dispalyed. An example is here; https://twitter.com/about/resources/...widget_profile You can see in the example how you can enter a different twitter user account, then hit 'test settings', leading to related twees being displayed. I can see how to do it but Im a super novice at JS so thought Id ask for assistance . Any code help is very much appreciated. Thx |