Jump to content

Wolverine68

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Everything posted by Wolverine68

  1. Trying to create a simple Event Listener such that was a key is press the element of the id is highlighted. I'm using IE, so I used "attachEvent" instead of addEventListener. Not getting any response when any of the keys are pressed. http://goken68.brinkster.net/EventListeners.html <html> <body> <head> <script type="text/javascript" language="javascript"> var ev = document.getElementById("north") ev.attachEvent('onkeydown',highlight,false); ev.attachEvent('onkeyup',highlight,false); </script> </head> <div id="teams"> <h1>NFL Teams</h1> <h2 id="north">NFC North</h2> <p>Chicago Bears</p> <p>Green Bay Packers</p> <p>Minnesota Vikings</p> <p>Detroit Lions</p> <h2>NFC South</h2> <p>New Orleans Saints</p> <p>Atlanta Falcons</p> <p>Carolina Panthers</p> <p>Tampa Bay Buccannears</p> <h2>NFC East</h2> <p>Dallas Cowboys</p> <p>Washington Redskins</p> <p>Philadelphia Eagles</p> <p>NY Giants</p> <h2>NFC West</h2> <p>San Francisco 49ers</p> <p>Arizona Cardinals</p> <p>Seattle Seahawks</p> <p>St.Louis Rams</p> </div>
  2. I was using Internet Explorer 8. When I tried it using Mozilla Firefox, it worked. Any thoughts on why it wouldn't work in Internet Explorer?
  3. Trying to familiarize myself with the preventDefault() event. Created a simple page so that when clicking on a url link, it displays a pop up box instead of, by default, opening up the website. When clicking on the link, it still opens the website. I tried using onmouseover instead of onClick and got errors: http://goken68.brinkster.net/PreventDefault.html Code: <html> <body> <head> <script type="text/javascript" language="javascript"> function urlClick(evt) { evt.preventDefault(); alert("You do not have access rights to that website!"); } </script> </head> <p>Click on the link below to see preventDefault() in action:</p> <br /> <br /> <a href="http://www.irs.gov" onClick="urlClick(event)">Go to Website</a> </body> </html>
  4. Just trying to right a simple script that will search for and display the child nodes and parent node when the applicable button is clicked. When clicking on "Show Child Nodes", nothing happens. When clicking on "Show Parent Node", the alert box just displays "null". http://goken68.brinkster.net/ChildandParentNodes.html <html> <body> <head> <script type="text/javascript" language="javascript"> function getchildNodes() { var content = document.getElementById("teams");//find the child Nodes of this element for (var i = 0; i < content.length; i++) { alert(content[i].childNodes.nodeValue);//display all the child nodes for the element, "teams".12:15 PM 2/8/2012 } } function getParentNode() { var node = document.getElementById("north");//find parent node of this element. alert(node.parentNode.nodeValue);//Display the parent node for element, "north". } </script> </head> <div id="teams"> <h1>NFL Teams</h1> <h2 id="north">NFC North</h2> <p>Chicago Bears</p> <p>Green Bay Packers</p> <p>Minnesota Vikings</p> <p>Detroit Lions</p> <h2>NFC South</h2> <p>New Orleans Saints</p> <p>Atlanta Falcons</p> <p>Carolina Panthers</p> <p>Tampa Bay Buccannears</p> <h2>NFC East</h2> <p>Dallas Cowboys</p> <p>Washington Redskins</p> <p>Philadelphia Eagles</p> <p>NY Giants</p> <h2>NFC West</h2> <p>San Francisco 49ers</p> <p>Arizona Cardinals</p> <p>Seattle Seahawks</p> <p>St.Louis Rams</p> </div> <input type="button" value="Show Child Nodes" onclick="getchildNodes()"> <br /> <br /> <input type="button" value="Show Parent Node" onclick="getParentNode()"> </body> </html>
  5. Trying to create a simple document that gets the parentNode then applies a background color. My getElementByTagName is "p" so the parentNode would be the <body>. The background color should then be applied to the entire document, right? I'm getting an "object expected" error. http://goken68.brinkster.net/ParentNode.html //purpose is to use parent node and change the background color <html> <body> <head> <script type="text/javascript" language="javascript"> function changeIt() { var node; node = document.getElementsByTagName("p").parentNode; node.style.background-color = '#0033dd'; } </script> </head> <div id="teams"> <h1>NFL Teams</h1> <h2>NFC North</h2> <p>Chicago Bears</p> <p>Green Bay Packers</p> <p>Minnesota Vikings</p> <p>Detroit Lions</p> <h2>NFC South</h2> <p>New Orleans Saints</p> <p>Atlanta Falcons</p> <p>Carolina Panthers</p> <p>Tampa Bay Buccannears</p> <h2>NFC East</h2> <p>Dallas Cowboys</p> <p>Washington Redskins</p> <p>Philadelphia Eagles</p> <p>NY Giants</p> <h2>NFC West</h2> <p>San Francisco 49ers</p> <p>Arizona Cardinals</p> <p>Seattle Seahawks</p> <p>St.Louis Rams</p> </div> <input type="button" value="change background color" onClick="changeIt()"> </body> </html>
  6. Made some changes. Now, the alert box only displays "undefined". http://goken68.brinkster.net/GetElementsByTag2.html <html> <body> <head> <script type="text/javascript" language="javascript"> function getNodes() { var content = document.getElementsByTagName('*');//using asterick as a wild card so that all nodes will be searched. for (var i = 0; i < content.length; i++) { alert(content[i].childNodes.innerHTML); } } </script> </head> <div id="teams"> <h1>NFL Teams</h1> <h2>NFC North</h2> <p>Chicago Bears</p> <p>Green Bay Packers</p> <p>Minnesota Vikings</p> <p>Detroit Lions</p> <h2>NFC South</h2> <p>New Orleans Saints</p> <p>Atlanta Falcons</p> <p>Carolina Panthers</p> <p>Tampa Bay Buccannears</p> <h2>NFC East</h2> <p>Dallas Cowboys</p> <p>Washington Redskins</p> <p>Philadelphia Eagles</p> <p>NY Giants</p> <h2>NFC West</h2> <p>San Francisco 49ers</p> <p>Arizona Cardinals</p> <p>Seattle Seahawks</p> <p>St.Louis Rams</p> </div> <input type="button" value="Show Nodes" onclick="getNodes()"> </body> </html>
  7. Trying to run a script that will display the name of every node in an HTML document. The URL to my page is below. When clicking on the "Show nodes" button, it gives "object expected" error for line 50 http://goken68.brinkster.net/GetElementsByTag.html <html> <body> <head> <script type="text/javascript" language="javascript"> function getNodes() { var content = document.getElementsByTagName(*); for (var i = 0; i < content.length; i++) { document.write(content[i].nodeName.innerHTML); } } </script> </head> <h1>NFL Teams</h1> <h2>NFC North</h2> <p>Chicago Bears</p> <p>Green Bay Packers</p> <p>Minnesota Vikings</p> <p>Detroit Lions</p> <h2>NFC South</h2> <p>New Orleans Saints</p> <p>Atlanta Falcons</p> <p>Carolina Panthers</p> <p>Tampa Bay Buccannears</p> <h2>NFC East</h2> <p>Dallas Cowboys</p> <p>Washington Redskins</p> <p>Philadelphia Eagles</p> <p>NY Giants</p> <h2>NFC West</h2> <p>San Francisco 49ers</p> <p>Arizona Cardinals</p> <p>Seattle Seahawks</p> <p>St.Louis Rams</p> <input type="button" value="Show Nodes" onclick="getNodes()"> </body> </html>
  8. Can't get a simple request form with mail() function to work. When clicking on the Submit button, it goes to the feedback.php file but just shows a blank page. It doesn't display the "Thank you, your request has been submitted" message along with the date and time which I included in the coding. HTML form: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Request Form</title> </head> <body background="#EEEEEE"> <h3 align="center">Request to Add to E-Mail List</h3> <div> <form action="feedback8.php" method="post"> <p><font color="blue">If you'd like to be added to the e-mail list, simply fill in your name and e-mail address, then click "Submit"</font></p> <hr width="100%"> <p>Name:&nbsp&nbsp&nbsp&nbsp&nbsp<INPUT TYPE="text" SIZE="35" name="name"></p> <p>E-mail:&nbsp&nbsp&nbsp&nbsp<INPUT TYPE="text" SIZE="35" name="email"></p> <br><br> <input type="submit" name="submit" value="Submit"><br><br> <hr width="100%"> </div> </body> </html> PHP file: <?php $formBody="Name:$name\nEmail:$email"; $headers = "From:$email"; if ($submit) { mail("me@yahoo.com", "Add to E-mail List Request", $formBody, $headers); } if ($submit) { print "Thank you. Your request has been submitted <br /> <br />"; print "Current date and time :"; print date("F j, Y g:i A T"); } ?>
  9. I just installed PHP. To confirm it's been installed I created the following test file as index.php: <html> <head> <title>My First PHP Page from my Local Server</title> </head> <body> <?php print "<h1>Hello World</h1>"?> </body> </html> I then saved the file to the root. But, when I try to display the web page, http://localhost/index.php I get the error, "404 - File Not Found". I saved it to "C:\ ". That is the "root", right?
  10. My webhost is Ripway, http://www.ripway.com I have a free account but it says PHP scripting is supported. Got any other recommendations of web hosts that offer a free account with PHP support?
  11. I created a form using the mail() function. Upon submission, it's just suppose to email the information entered. Instead, I get the error "HTTP Error 405 - The HTTP verb used to access this page is not allowed." <body> <?php $recipient = "me@yahoo.com"; $subject = "Registration Submission"; $body = "<h2>Registration Information:</h2>"; if(!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['question'])) { $body .= "\r\nName: " . $_POST['name']; $body .= "\r\nEmail: " . $_POST['email']; $body .= "\r\nQuestion: " . $_POST['question']; } if (mail($recipient, $subject, $body)) { print("Email successfully sent!"); } else { print("The email could not be sent."); } ?> <form method="POST" action=""> <h2 align="center">Sending Email</h2> <br /> <div> <p>Enter your name and email address, a question, and click "Submit":</p> <br /> <p>Name:<input type="text" name="name" size="20"></p> <p>Email:<input type="text" name="email" size="20"></p> <p>Question:<input type="text" name="question" size="20"></p> </div> <br /> <div> <input type="submit" name="submit" value="Submit" /> </div> <br /> <div> <input type="reset" name="Reset" value="Start Over" /> </div> </form> </body> </html>
  12. Just tried to create a simple form where the user enters a message to display. When submitted, it is to save the message to a text file. When clicking on "Message to Display" it gives the error "Fatal error: Call to undefined function: file_put_contents() in \\192.168.0.16\webfiles\files\2011-5\3627559\setmessage.php on line 16" <?php if($_SERVER['REQUEST_METHOD'] != 'POST') { ?> <form method="POST" action="setmessage.php" name="setmessage"> <p>Message to Display:<Input type="text" name="message" size="50"></p> <p><input type="submit" value="Submit" name="submit"></p> </form> <?php } else { //Writes the contents of the message to a file file_put_contents('message.txt', $_POST['message']); } ?> I also tried print file_put_contents('message.txt', $_POST['message']); and echo file_put_contents('message.txt', $_POST['message']); Still get the same error
  13. Just trying to create a simple form that will let you enter a message that will get written to a text file. Code for SetMessage.php: <?php if($_SERVER['REQUEST_METHOD'] != 'POST') { ?> <form method="POST" action="setmessage.php" name="setmessage"> <p>Message to Display:<Input type="text" name="message" size="50"></p> <p><input type="submit" value="Submit" name="submit"></p> </form> <?php } else { //Writes the contents of the message to a file echo file_put_contents('message.txt', $_POST['message']); } ?> When submitting, I get the error "Call to undefined function: file_put_contents() on line 16"
  14. Created a simple html form. Upon submission, it's suppose to email the information entered in the form to the designated recipient. Instead, I get the error "The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access. " -------------------------------------------------------------------------------- <!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" xml:lang="en" lang="en"> <head> <title>Mail Function</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php $recipient = "me@yahoo.com"; $subject = "Registration Submission"; $body = "<h2>Registration Information:</h2>"; $body .= "\r\nName: ($_POST['name'])"; $body .= "\r\nEmail: ($_POST['email']"; $body .= "\r\nQuestion: ($_POST['question']"; if (mail($recipient, $subject, $body)) { print("Email successfully sent!"); } else { print("The email could not be sent."); } ?> <form method="post"> <h2 align="center">Week 2 Project--Sending Email</h2> <br /> <div> <p>Enter your name and email address, a question, and click "Submit":</p><br /> <p>Name:<input type="text" name="name" size="20"></p> <p>Email:<input type="text" name="email" size="20"></p> <p>Question:<input type="text" name="question" size="20"></p> </div> <br /> <div><input type="submit" name="submit" value="Submit" /></div> <br /> <div> <input type="reset" name="Reset" value="Start Over" /> </div> </form> </body> </html>
  15. I'm using Brinkster as my host. This is my first time trying to use POST on their server. I had a free account with them before and that did not run PHP so I upgraded to their Rookie account. Not following you on your second comment. Why won't the PHP script set any cookies?
  16. Trying to run a simple program that, when submitted, stores the username and password as cookies. When clicking Submit, I get the error "HTTP Error 405 - The HTTP verb used to access this page is not allowed". If the username and password fields are left blank when submitting it's suppose to give a message to enter a username and password, but, I still get that error message. HTML form: <!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" xml:lang="en" lang="en"> <head> <title>Week 1 Project--Cookies</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <form action="cookie1.php" method="post"> <h2 align="center">Cookies</h2> <br /> <div> <p>Enter your username and password and click "Submit":</p><br /> <p>Username:<input type="text" name="username" size="20"></p> <p>Password:<input type="text" name="password" size="20"></p> </div> <br /> <div><input type="submit" name="submit" value="Submit" /></div> <br /> <div> <input type="reset" name="Reset" value="Start Over" /> </div> </form> </body> </html> PHP file: <!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" xml:lang="en" lang="en"> <head> <title>Cookie File</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <div> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { setcookie('username', $_POST['username'], time() + 2592000); setcookie('password', $_POST['password'], time() + 2592000); } if(($_POST['username'] == "") || ($_POST['password'] == "")) { print "You must enter both a username and password. Press the Back button on your browser and try again."; } else if (isset($_COOKIE['username'])) { print "Welcome, " .$_COOKIE['username']; } ?> </div> </body> </html>
  17. I created a request form in an Article in a Joomla! 1.5 template. When the form is submitted it calls the php form but the only thing that prints out is the actual php coding. It does not process the information that is entered in the form when it's submitted. Request Form: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Request Form</title> </head> <body background="#EEEEEE"> <img src="pics\um-cross3.gif" height="100" width="100"><img src="pics\title.gif"><br> <h3 align="center">Information Request Form</h3> <div> <form action="feedback.php" method="post"> <p><font color="blue">Thank you for visiting our website. If you would like more information, please fill out all the information in the form below. When finished, click on the "Submit" button. Be sure to include your address, e-mail, or phone so that someone can follow up with you.</font></p> <hr width="100%"> <p>Name:&nbsp&nbsp&nbsp&nbsp&nbsp<INPUT TYPE="text" SIZE="35" name="name"></p> <p>E-mail:&nbsp&nbsp&nbsp&nbsp<INPUT TYPE="text" SIZE="35" name="email"></p> <p>Phone:&nbsp&nbsp&nbsp&nbsp<INPUT TYPE="text" SIZE="35" name="phone"></p> <p>Address: <INPUT TYPE="text" SIZE="35" name="address"></p><br> I would like more information on the following (check all that apply):<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Adult Sunday School">Adult Sunday School<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Bible Studies"">Bible Studies<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Children's Programs">Children's programs<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Missions">Missions<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Music">Music/Choir<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Youth">Youth group<br><br> Please add any additional comments or questions in the box below:<br> <TEXTAREA NAME="comments" ROWS=10 COLS=60> </TEXTAREA> <br><br> <input type="submit" name="submit" value="Submit"><br<br> <hr width="100%"> </div> </body> </html> feedback.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <body> <?php $checkbox0 = $_POST['Programs'][0]; $checkbox1 = $_POST['Programs'][1]; $checkbox2 = $_POST['Programs'][2]; $checkbox3 = $_POST['Programs'][3]; $checkbox4 = $_POST['Programs'][4]; $checkbox5 = $_POST['Programs'][5]; ?> <?php $formBody="Name:$name\nEmail:$email\nPhone:$phone\nAddress:$address\nI'd like more information on the following programs: $checkbox0, $checkbox1, $checkbox2, $checkbox3, $checkbox4, $checkbox5 \nComments:$comments"; $headers = "From:$email"; if ($submit) { mail("wolverineken@yahoo.com", "Church Information Request",$formBody, $headers); print "Thank you. Your request has been submitted <br /> <br />"; print "Current date and time :"; print date("F j, Y g:i A T"); } ?> </body> </html> Just to clarify, when the form is submitted, the actual code inside if($submit) is printed out.
  18. I created a request form with a CAPTCHA script (for filtering out spammers). If the form is submitted without the correct string it is suppose to give an error message. If the form is submitted with the correct string then it's suppose to give a thank you message along with the current time and date. I've tested both scenarios but in both cases it just goes to a blank screen. Here's the link to the form: http://klb68.comxa.com/request_form11.html HTML form code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php session_start(); ?> <html> <head> <title>Request Form</title> </head> <body background="#EEEEEE"> <img src="pics\um-cross3.gif" height="100" width="100"><img src="pics\title.gif"><br> <h3 align="center">Information Request Form</h3> <div> <form action="feedback11.php" method="post"> <p><font color="blue">Thank you for visiting our website. If you would like more information, please fill out all the information in the form below. When finished, click on the "Submit" button. Be sure to include your address, e-mail, or phone so that someone can follow up with you.</font></p> <hr width="100%"> <p>Name:&nbsp&nbsp&nbsp&nbsp&nbsp<INPUT TYPE="text" SIZE="35" name="name"></p> <p>E-mail:&nbsp&nbsp&nbsp&nbsp<INPUT TYPE="text" SIZE="35" name="email"></p> <p>Phone:&nbsp&nbsp&nbsp&nbsp<INPUT TYPE="text" SIZE="35" name="phone"></p> <p>Address: <INPUT TYPE="text" SIZE="35" name="address"></p><br> I would like more information on the following (check all that apply):<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Adult Sunday School">Adult Sunday School<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Bible Studies"">Bible Studies<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Children's Programs">Children's programs<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Missions">Missions<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Music">Music/Choir<br> <INPUT TYPE="checkbox" NAME="Programs[]" VALUE="Youth">Youth group<br><br> Please add any additional comments or questions in the box below:<br> <TEXTAREA NAME="comments" ROWS=10 COLS=60> </TEXTAREA> <br><br> <p><img src="Cap_Img.php"><br><br> <input type="button" value="Refresh Image" onClick="window.location.href=window.location.href"></p> <p>Before submitting your request, please enter the string shown in the image into the box below.</p> <p><input name="number" type="text"></p> <input type="submit" name="submit" value="Submit"><br><br> <hr width="100%"> </div> </body> </html> feedback.php code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <body> <?php $checkbox0 = $_POST['Programs'][0]; $checkbox1 = $_POST['Programs'][1]; $checkbox2 = $_POST['Programs'][2]; $checkbox3 = $_POST['Programs'][3]; $checkbox4 = $_POST['Programs'][4]; $checkbox5 = $_POST['Programs'][5]; ?> <?php $formBody="Name:$name\nEmail:$email\nPhone:$phone\nAddress:$address\nI'd like more information on the following programs: $checkbox0, $checkbox1, $checkbox2, $checkbox3, $checkbox4, $checkbox5 \nComments:$comments"; $headers = "From:$email"; if ($submit) { mail("wolverineken@yahoo.com", "Church Information Request",$formBody, $headers); } if ($submit) { print "Thank you. Your request has been submitted <br /> <br />"; print "Current date and time :"; print date("F j, Y g:i A T"); } ?> </body> </html> Captcha code: <?php session_start(); $md5_hash = md5(rand(0,9999)); $security_code = substr($md5_hash, 25, 5); $enc=md5($security_code); $_SESSION['count'] = $enc; $secure = $_SESSION['count']; // echo "--------------------------$secure<br>"; $width = 100; $height = 40; $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 100, 0); $grey = ImageColorAllocate($image, 204, 204, 204); ImageFill($image, 0, 0, $grey); //Add randomly generated string in white to the image ImageString($image, 10, 30, 10, $security_code, $black); ImageRectangle($image,0,16,$width-1,$height-1,$grey); imageline($image, 0, $height/2, $width, $height/2, $grey); imageline($image, $width/2, 0, $width/2, $height, $grey); header("Content-Type: image/jpeg"); ImageJpeg($image); ImageDestroy($image); ImageDestroy($image); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.