Jump to content

Search the Community

Showing results for tags 'javascript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. I have the following codes: if(window.location.pathname.search(/\?/) != -1) { var refUrl = window.location.pathname.strip(/\?/); } else { var refUrl = window.location.pathname; } var pathname = refUrl += '/' + 'hey' + '/' + 'what'; alert(refUrl); I'm running a check to see if there are any characters in the pathname, if so, strip it out. The output is : /_display//hey/what So basically it didn't strip anything characters out from the pathname after testing this on jsfiddle. Can someone please tell me what's wrong with it? Thank you, halben
  2. Dear , I am need of some thing with the help of which i would be able to generate dynamic/variable documents for my business use. I need a data input page where one can feed all data at one place & later on same data came be parsed to various pre formated documents. As per my need, i have to write several documents related to single business deal. I have to fill up same details in all those documents. So, my idea is fill up all such information at one place then later on, the same data can be passed on to all related documents for printing purpose. You can create one data entry module (like forms etc.) to collect relevant data then create another module in which i can link different documents format in which data can be lifted from the collected information. I requires to create something which can hold input variables then you have to retrieve all those variable in documents. I am attaching 3 files in order to understand you better my project. These 3 files are having data sample, sample document & finished document. link of document ; http://goo.gl/fVKBmv project.zip
  3. Hi, I have an ecommerce site and i want to have a bookmarklet. I heard it should be done in javascript. Does anyone here who can help me? I'm a newbie but i'm a fast learner. thank you.
  4. I have creating a contact form with validation. but i have no idea to validate the contact form which platform. anybody having new idea to validate the contact form pls reply. otherwise tell any good PHP Training Institutes? My friends are recommending this PHP Training Institute
  5. Hi I have a registration page for a website, in that i want to generate random number to disable the person's profile. Here the random number should generate after he creates his profile and that should be sent to the person through mail. He should enter that number for disabling his profile. I want the sample code or script by which i can implement easily. Thanks in advance Revs
  6. Hey, I would like to import data from CSV files to my application, First i've upload csv on to server then get csv contents by fgetcsv(), after that i want to map uploaded data and validate then send to db otherwise show error. Please suggest me how to do. Thanks
  7. Greetings all, I have a bit of challenge that I don't know exactly how to solve. What I am trying to do is open a popup window using javascript and also redirect the page that has the original link on it to a new page. Basically what I want to happen is, user clicks on link, page redirects and a popup window opens at the same time. Sort of like having two links in one. Here's what I tried. It didn't work. echo ' <a href="sectvideo.php?sect=' . $row[0] . '"> ' . "<a href=\"javascript:create_window('".$row[1]."',640,360)\">" . ' <div id="historyUniqueWrap"> <div id="historyUniqueImage"> <img src="'. $row[2] .'"/> </div> <div id="historyUniqueTitleMessageWrap"> <div id="historyUniqueTitle"> <h4>Section: ' . $row[0] . " >>" . '</h4> <p>' . stripslashes($post1). "..." . '</p> </div> </div></a></a> Any ideas? Best Regards, Nightasy Edit: I just had an idea, I could set a condition to be met in the page that is being linked to using a GET. That would solve this issue. I'll try that and report back if it works or not.
  8. Hi, I am not asking for code, If you provide it thank you but I am happy to do the work myself I am more after the concept and code snippets. My Goal, I have 2 domains for this I will use www.1.com and www.2.com to make it easy. 1.com has a couple lines of javascript and 2 variables 1 being a domain and the other being a unique ID 2.com has a php script which is called by 1.com when the page is loaded (somehow) it will check the Unique ID and the domain that they match in a mySQL database and if they do to run another javascript script. If it does not to just end itself. The problem I have is I know PHP to an average level but Javascript well below average. I need to know how to run the PHP script from an external site 1.com to run a generic PHP script from 2.com and use the variables from 1.com to check the database at 2.com for a match and to either say yes matching display: or not matching deny. If anyone has any ideas on how to do this or something they have done before that would be awesome. I am wanting to to put the javascript on 10 different websites with different variables and for 2.com to just do the checking. for security reasons I need the URL to be checked so if 1.com loads and says the URL is 1.com but infact the user loaded 55.com it needs to be denied so PHP on 2.com needs to know where the request came from which domain... PLEASE HELP
  9. I am new to PHP, i started developing application using php, please look into my code index.php <?php require_once('./config.php'); ?> <?php /* * Following code will get single product details * A product is identified by product id (pid) */ // array for JSON response $response = array(); // check for required fields if (isset($_POST['name'])) { $title = $_POST['name']; $company = $_POST['company']; require_once('./db_connect.php'); // connecting to db $db = new DB_CONNECT(); // mysql inserting a new row $result = mysql_query("INSERT INTO user(name,company) VALUES('$title','$company')"); } ?> <html> <head> <link type="text/css" rel="Stylesheet" href="style.css" /> <script type="text/javascript" src="jquery-1.7.2.js"></script> <script type="text/javascript"> $(window).load(function () { var tabContents = $(".tab_content").hide(), tabs = $("ul.tabs li"); tabs.first().addClass("active").show(); tabContents.first().show(); tabs.click(function() { var $this = $(this), activeTab = $this.find('a').attr('href'); if(!$this.hasClass('active')){ $this.addClass('active').siblings().removeClass('active'); tabContents.hide().filter(activeTab).fadeIn(); } return false; }); $(".tabbutton").click(function () { var nextTab = parseInt($("li.active").attr("id"), 10) + 1; if (nextTab === 4) { nextTab = 1; } tabs.removeClass("active"); $("#" + nextTab).addClass("active"); tabContents.hide(); $("#tab" + nextTab).fadeIn("slow"); }); }); </script> <script type="text/javascript" src="https://js.stripe.com/v1/"></script> <!-- jQuery is used only for this example; it isn't required to use Stripe --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script type="text/javascript"> // this identifies your website in the createToken call below Stripe.setPublishableKey("<?php echo $stripe['publishable_key']; ?>"); function stripeResponseHandler(status, response) { if (response.error) { // re-enable the submit button $('.submit-button').removeAttr("disabled"); // show the errors on the form $(".payment-errors").html(response.error.message); } else { var form$ = $("#payment-form"); // token contains id, last4, and card type var token = response['id']; // insert the token into the form so it gets submitted to the server form$.append("<input type='hidden' name='stripeToken' value='" + token + "' />"); // and submit form$.get(0).submit(); } } $(document).ready(function() { $("#payment-form").submit(function(event) { // disable the submit button to prevent repeated clicks $('.submit-button').attr("disabled", "disabled"); // createToken returns immediately - the supplied callback submits the form if there are no errors Stripe.createToken({ number: $('.card-number').val(), cvc: $('.card-cvc').val(), exp_month: $('.card-expiry-month').val(), exp_year: $('.card-expiry-year').val() }, stripeResponseHandler); return false; // submit from callback }); }); <body> <ul class="tabs clearfix"> <li id="1"><a href="#tab1">Tab1</a></li> <li id="2"><a href="#tab2">Tab2</a></li> <li id="3"><a href="#tab3">Tab3</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content"> <form method="post"> <p> <label>Name:</label> <input type="text" name="name"> </p> <p> <label>Company:</label> <input type="text" name="company"> </p> <input type="submit" value="SAVE" class="tabbutton"/> </form> </div> <div id="tab2" class="tab_content"> <form id="payment-form" action="charge.php" method="post"> <h3>Purchase a quote by Oscar Wilde today! Only $535! Limited supply and going fast, buy now!!</h3> <!-- to display errors returned by createToken --> <span class="payment-errors"></span> <form action="charge.php" method="POST" id="payment-form"> <div class="form-row"> <label>Card Number</label> <input type="text" size="20" autocomplete="off" class="card-number" /> </div> <div class="form-row"> <label>CVC</label> <input type="text" size="4" autocomplete="off" class="card-cvc" /> </div> <div class="form-row"> <label>Expiration (MM/YYYY)</label> <input type="text" size="2" class="card-expiry-month"/> <span> / </span> <input type="text" size="4" class="card-expiry-year"/> </div> <button type="submit" class="submit-button">Buy!</button> </form> </form> </div> <div id="tab1" class="tab_content"> <p>Tab 3 Content Goes Here...</p> </div> </div> </body> </html> In Tab1 I'm saving data into database. Whenever user clicks on the save button the data needs to be saved into database and it will go to Tab2. I am successful while saving the data. My problem is it is not going to Tab2 after saving the data. When we click on the save button, the tab2 is just blinking but the page is still showing tab1 content. I want that whenever the user clicks on the save button the data needs to be saved in database and it will go to Tab2 content. Any suggestions?
  10. hello i got a problem with ajax-php that is including html file, javascript external file, php external file. now i got a problem give a value to button,button2,button3 when the php write the html code, but if the javascript or it wrote in the html file already the javascript is working fine, also jquery isn't working as well if the php create the html (div, textarea, input and br) code. what is the problem with the ajax-php version and why functions button_onload() and disabled_div_textarea_text2() not working well? first version-ajax-php version: (function button_onload() and function disabled_div_textarea_text2() isn't working in this version) here is the code of the html file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="index.js"></script> <link rel="stylesheet" href="index.css" /> <!--<script src="jquery-2.0.3.min.js"></script>--> <title>textbox changing with ajax - php - version 1</title> <!-- javascript code --> <script language="JavaScript"> </script> </head> <body id='body'> <div id='div_textarea'></div> </body> </html> here is the code of the JavaScript file: try { /* ajax-php */ function ajax_php() { var str = new String; str = '1'; //alert('str2'); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } //alert('str3'); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('div_textarea').innerHTML = xmlhttp.responseText; //document.getElementById('div_textarea').value = xmlhttp.responseText; //alert(xmlhttp.responseText); } } //alert('str4'); xmlhttp.open("POST","index.php?str=" + str, true); xmlhttp.send(); } /* fffff */ onload = function() { ajax_php(); /* load fuinctions */ /* --------------- */ button_onload(); clear_textarea1_2(); disabled_div_textarea_text2(); } /* fffff */ function button_onload() { /* first version */ /* ------------- */ document.getElementById('button').innerHTML = 'button 1'; document.getElementById('button2').value = 'button 2'; document.getElementById('button3').value = 'clear/clean'; } /* fffff */ function button() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* fffff */ function button2() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* textarea functions */ /* ------------------ */ /* fffff */ function clear_textarea1_2() { clear_div_textarea_text(); clear_div_textarea_text2(); } /* fffff */ function clear_div_textarea_text() { document.getElementById('div_textarea_text').value = ''; } /* fffff */ function clear_div_textarea_text2() { document.getElementById('div_textarea_text2').value = ''; } /* fffff */ function disabled_div_textarea_text2() { document.getElementById('div_textarea_text2').disabled = true; document.getElementById('div_textarea_text3').readOnly = true; } } catch(err) { txt='There was an error on this page.\n\n'; txt+='Error description: ' + err.message + '\n\n'; txt+='Click OK to continue.\n\n'; alert(txt); } here is the php code file: <?php $str1 = '<br />'; $str2 = '<textarea id="div_textarea_text"></textarea>'; $str3 = '<div id="button" onclick="button();"></div>'; $str4 = '<input type="button" onclick="button2();" id="button2" value="" />'; $str5 = '<textarea id="div_textarea_text2"></textarea>'; $str6 = '<input type="button" onclick="clear_textarea1_2();" id="button3" />'; $str7 = '<textarea id="div_textarea_text3"></textarea>'; echo($str1 . $str2 . $str1 . $str3 . $str1 . $str4 . $str1 . $str5 . $str1 . $str6 . $str1 . $str7); ?> but now take a look at this second version- php file with JavaScript: (php file and JavaScript file and working fine.) the php file code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="index.js"></script> <link rel="stylesheet" href="index.css" /> <script src="jquery-2.0.3.min.js"></script> <title>textbox changing with php - version 2</title> <!-- javascript code --> <script language="JavaScript"> </script> </head> <body id='body'> <div id='div_textarea'> <?php $str1 = '<br />'; $str2 = '<textarea id="div_textarea_text"></textarea>'; $str3 = '<div id="button" onclick="button();"></div>'; $str4 = '<input type="button" onclick="button2();" id="button2" value="" />'; $str5 = '<textarea id="div_textarea_text2"></textarea>'; $str6 = '<input type="button" onclick="clear_textarea1_2();" id="button3" />'; $str7 = '<textarea id="div_textarea_text3"></textarea>'; echo($str1 . $str2 . $str1 . $str3 . $str1 . $str4 . $str1 . $str5 . $str1 . $str6 . $str1 . $str7); ?> </div> </body> </html> JavaScript file code: try { /* fffff */ onload = function() { /* load fuinctions */ /* --------------- */ button_onload(); clear_textarea1_2(); disabled_div_textarea_text2(); } /* fffff */ function button_onload() { /* first version */ /* ------------- */ document.getElementById('button').innerHTML = 'button 1'; document.getElementById('button2').value = 'button 2'; document.getElementById('button3').value = 'clear/clean'; } /* fffff */ function button() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* fffff */ function button2() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* textarea functions */ /* ------------------ */ /* fffff */ function clear_textarea1_2() { clear_div_textarea_text(); clear_div_textarea_text2(); } /* fffff */ function clear_div_textarea_text() { document.getElementById('div_textarea_text').value = ''; } /* fffff */ function clear_div_textarea_text2() { document.getElementById('div_textarea_text2').value = ''; } /* fffff */ function disabled_div_textarea_text2() { document.getElementById('div_textarea_text2').disabled = true; document.getElementById('div_textarea_text3').readOnly = true; } } catch(err) { txt='There was an error on this page.\n\n'; txt+='Error description: ' + err.message + '\n\n'; txt+='Click OK to continue.\n\n'; alert(txt); }
  11. <?php $user="root"; $password=""; $database="base"; $host="localhost"; $table="com"; mysql_connect($host, $user, $password) or die("error"); mysql_select_db($database) or die("error"); $name = $_POST['name']; $lastname = $_POST['lastname']; $email = $_POST['email']; $coment= $_POST['coment']; $error = ''; if(empty($name) || empty($lastname) || empty($email) || empty($coment)) { $error .= 'error. '; } if(!preg_match("/^[a-zA-A]+$/i", $name)) { $error .= 'Error '; } if(!preg_match("/^[a-zA-A]+$/i", $lastname)) { $error .= 'Error '; } if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email)) { $error .= 'errorl. '; } if(!preg_match("/^[a-zA-z0-9.,?!]+$/i", $comment)) { $error .= 'Error '; } if($error == '') { $result = "INSERT INTO com (name, lastname, email, coment) VALUES('$name', '$lastname', '$email','$coment')"; echo "<script type='text/javascript'>alert('Thanks.'); window.close();</script>";} else{ echo"<script type='text/javascript'>alert ('$error'); window.close(); </script>";} Errors seems to be working its just it won't insert data in table in mysql database.... Thank you so much.
  12. I built a custom templating class that uses DOMDocument to manipulate some of the nodes/tags within my html. I run into all kinds of problems when I use inline js (js that lives on page) Most notably with < and & used in the js itself. This code exibits some of the problems: $domStr = ' <!DOCTYPE html> <head> <meta charset="utf-8"/> <title>my page</title> <script> var elem = "<div>some content</div>"; </script> </head> <body> <div> MY PAGE </div> </body> </html> '; $doc = new DOMDocument(); libxml_use_internal_errors(true);//prevents tags in js from throwing errors; see php.net manual $doc->formatOutput = true; $doc->strictErrorChecking = false; $doc->preserveWhiteSpace = true; $doc->loadHTML($domStr); echo $doc->saveHTML(); exit; and the html output is: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>my page</title> <script> var elem = "<div>some content"; </script> </head> <body> <div> MY PAGE </div> </body> </html> You'll notice that the closing </div> tag is removed. ??? I have very dissapointed with domdocument overall as it doesn't seem to always do what it promises to do...even with preserving space/formatting etc. I'm to the point at which I might just abandon domdocument altogether and parst the html myself with regex (yuck) any expert advice in this matter would be greatly appretiated.
  13. Hello so I'm trying to make my own simple forum. How would can I do a quick quote/ reply to comment. Something WordPress would normally do with the #respond. I've done my own code and I can't seem to insert the code into a hidden input so that the users can't see the HTML codes that are outputted in the reply string. Generally, my code works fine and all, it's just that when someone clicks the "Quote" link, it literally inserts the actual HTML outputs into the textarea. I want something like WordPress' #respond command so that when someone hits the "Quote" link, it'll still quote the actual content the user is trying to respond to, but it'll also not output the HTML codes into the textarea. Here is my PHP code: <?php $reply = '<div style=\"border: 1px dashed\"><span style=\"text-transform: uppercase; font-family: Oswald, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: 300; margin: 0px 10px 0px 0px; width: 100%; color: #00A6EB;\">' . $row['username'] . '</span><p>' . $row['message'] . '</p></div><br /><br />'; ?> Here is my HTML code: <a href="#" onclick='insertext("<? echo $reply; ?>"); return false;'>Quote</a> Here is my Javascript code: <script type="text/javascript"> function insertext(text) { document.formname.messages.value += text + " "; document.formname.messages.focus(); } </script>
  14. HI. Can anyone help me. I've change the code here and there to make it works but failed. The problem is there is 2 files to be uploaded, but only the second one will display alert message, while the first one will just receive any file. EG: I try select the same file for both. But the first one does not respond while the second part respond that it is not the acceptable file extension. Here is the code. <script> function checkFile() { var node_list = document.getElementsByTagName('input'); for (var i = 0; i < node_list.length; i++) { var node = node_list[i]; if (node.getAttribute('type') == 'file') { var sFileName = node.value; var sFileExtension = sFileName.split('.')[sFileName.split('.').length - 1]; var iFileSize = node.files[0].size; var iConvert=(node.files[0].size/10485760).toFixed(2); } if (sFileExtension != "pdf" && sFileExtension != "doc" && sFileExtension != "docx" && iFileSize>10485760) { txt="File type : "+ sFileExtension+"\n\n"; txt+="Size: " + iConvert + " MB \n\n"; txt+="Please make sure your file is in pdf or doc format and less than 10 MB.\n\n"; alert(txt); } } } </script> my form, <input type="file" name="file" id="confirm" onchange="checkFile()"> <input type="file" name="file" id="approveletter" onchange="checkFile()"> Please help me...
  15. please help , I want the feild highlighted before 1 month till the expiry date.
  16. <!DOCTYPE html> <html> <head> <script> function HideComment() { document.GetElementById("comments").hide("textarea") } </script> </head> <body> <textarea name="" cols="" rows="" id="comments" onClick="">leave comment</textarea> </body> </html> i am trying to get the text area to hide when i click a button. this is what i have but doesnt seem to work. can someone help me?
  17. Hello. I'm having troubles disabling right click on images. The website shows the message that is supposed to be shown when I perform the right click, but also shows the right click menu (copy, save image as, etc.). What is the problem with this code (I'm not pasting the tags, only the "body" of the code)? var clickmessage="Clique com o botão direito desactivado nas imagens!" function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="IMG"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="IMG"){ alert(clickmessage) return false } } } function associateimages(){ for(i=0;i<document.images.length;i++) document.images.onmousedown=disableclick; } if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associateimages()
  18. Try to keep this short. I have a monitor set up flipped so the resolution is 768px wide by 1360px tall. This is a touch device. Since my client didn't want to pay for me to develop an app for said touch device but wanted his websites just displayed as links (sites are responsive and local) I'm using Google Chrome to display these pages. They are all three HTML 5 and he's running XP so IE (not that I would have used it anyway) is out of the question. My problem is "Y" axis touch scrolling does not work with the drivers included with this touch device. So I've been looking for javascript solutions online. Tried tons of them. The only thing that seems to work is Zynga Easy Scroll. With the exception that it will only scroll to a certain point on the page then stops. It will not allow access to any information further down the page. My assumption is that the DOM I'm targeting has now scrolled too far up the page and I no longer have access to it. Currently though, that DOM is the body tag itself. I have also tried placing the entire page in a <div> with the scrollable applied to it but have the same results so applying it to the body tag isn't the issue. Anyone have experience with this javascript and have a solution for this not to bounce back and leave the bottom third of my page from displaying? I mean anything short of me starting all over using jquery mobile or Sencha Touch 2. Like I said, client doesn't want to pay for the time it would take for me to totally rebuild pages as an app. But those would just create an HTML 5 application anyway so don't see that even that's a solution with no "Y" axis scrolling ability. Thanks, Dave
  19. Hello all, I am trying to call two functions onclick of a submit button. the two functions inturn go to two php scripts..i want the php scripts to be run one after the other. But, its not working. Please take a look at my code and suggest some changes my html : <form method="post" action="" name="form"> <label> New Data set: </label> <input type="radio" name="url" value="NetOptInput2.html" id="ex1" required/> Yes <input type="radio" name="url" value="NetOptResult2.html" id="ex2" required/> No <br><br><br> <label>Dataset description: </label> <input type="text" name="dataset" id="field1" size="30" placeholder="" readonly><br><br><br> <label>Token Number : </label><input type="text" name="token" id="field2" size="6" placeholder="" readonly><br><br><br> <div style="text-align: center"><br> <input type="Submit" name="submit" value="Submit" class="submit" onclick="return(OnButton2() && OnButton1())"> <div class="spacer"></div> </form> My Javascript <!-- this function navigates user according to the radio button selection--> <script language="Javascript"> function OnButton1() { document.form.action = "Input1a.php" // document.form.target = "_blank"; // Open in a new window //document.form.submit(); // Submit the page // return true; } function OnButton2() { document.form.action = "Input1b.php" //document.form.target="_blank"; // document.form.submit(); // Submit the page // return true; } <!--This function disables the Token Number form if the user clicks "yes" radio button and disables Dataset if "No"--> <script type="text/javascript"> $(function(){ $("#ex1, #ex2").change(function(){ $("#field1, #field2").val("").attr("readonly",true); if($("#ex1").is(":checked")){ $("#field1").removeAttr("readonly"); $("#field1").focus(); } else if($("#ex2").is(":checked")){ $("#field2").removeAttr("readonly"); $("#field2").focus(); } }); }); MY php file1 if (isset($_POST) && $_POST['url1'] == "Yes") { header('Location: NetOptInput2.html'); } else if (isset($_POST) && $_POST['url2'] == "No") { header('Location: NetOptResult2.html'); } my php file 2 if (isset($_POST['submit'])) { $dataset = $_POST['dataset']; $tokennumber = $_POST['tokennumber']; $data = "$dataset | $tokennumber\n"; $file = "input.txt"; $fp = fopen($file, "w") or die("Couldn't open $file for writing!"); fwrite($fp, $data) or die("Couldn't write values to file!"); fclose($fp); $message = "Saved to $file successfully!"; }
  20. My code is, <?php function getreg($id) {return file_get_contents('http://arcbots.com/userinfo.php?id='.$id);} function getID($reg) {return file_get_contents('http://arcbots.com/userinfo.php?reg='.$reg);} function lastseen($user) {return file_get_contents('http://arcbots.com/userinfo.php?lastseen='.$user);} function getdisplayname($user) {return file_get_contents('http://arcbots.com/userinfo.php?displayname='.$user);} function gethomepage($user) {return file_get_contents('http://arcbots.com/userinfo.php?homepage='.$user);} function getavatar($user) {return file_get_contents('http://arcbots.com/userinfo.php?avatar='.$user);} function getuserinfo($user) {return file_get_contents('http://arcbots.com/userinfo.php?info='.$user);} ?> <center>This will search a users ID and return the Registered name</center> <html> <link rel="stylesheet" type="text/css" href="style.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/custom.css" /> <center><form method="post" /> <input type="text" name="search"> <input type="submit" value="get regname" name="submit"> </form></center> <?php function display() { echo getReg($_POST['search']); } if(isset($_POST["search"])) { display(); } ?> </html> I have two quick questions: 1 - How would I output the returned information it gives me in a popup window. side note: I'd like to keep the original output on the page just incase their browser blocks the popup. 2 - How would I create a usable dropdown menu that can select what function they want to use
  21. I am looking for a webdesigner / coder who can create the basic CSS for a fluid adaptive website. The main layout would be something like the 'Mondrian' example here http://designshack.net/articles/css/5-really-useful-responsive-web-design-patterns/ navigation design would be something like this. http://www.impressivewebs.com/demo-files/css3-glow-tabs/ At the moment I am too busy with different projects to spend a lot of time figuring out the new CSS possibilities and therefore I am looking for someone to help me. Please contact me by PM on phpfreaks thank you anatak
  22. Hello, I am currently developing a site but I have ran into a problem. The Google Maps is not rendering correctly and a grey area is visible. I have tried to use the resize facility initiated on window.onload and I have provided inline styling but to no avail. Any suggestion will be greatly appreciated. The Page with map implement can be found at http://www.esfdev.co.uk/bede/contact-us-and-lettings/find-us/ .Again and help will be greatly appreciated.
  23. my code below works perfect in Mozilla and Chrome but not in IE8, when i select a Radio button in IE its showing other options for other Radio button, need help in fixing the issue in IE8 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script src="jquery.chained.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <link rel="stylesheet" href="style.css" /> <script type="text/javascript" src="infratool.js"></script> <script> $(function() { $("#submit").hide(); $("#Category").change(function() { window.location = $(this).val().split(" ")[0]; if(loc) window.location.href = loc; }) }); </script> <table width="392" border="0"> <td colspan="2" align="center"><form id="form1" name="form1" method="post" action=""> <tr> <td align="center"> <label><input name="Radio1" type="radio" id="TestA" value="TestA" onclick="showSelect();" />TestA</label> <label><input name="Radio1" type="radio" id="TestB" value="TestB" onclick="showSelect();" />TestB</label> </td> </tr> </form> <div id="div-id" align="center"><select name="Category" id="Category" class="hide"> <option value=" TestA TestB" selected="selected">--</option> <option value="TestA1.php TestA">TestA1</option> <option value="TestA2.php TestA">TestA2</option> <option value="TestA3.php TestA">TestA3</option> <option value="TestA4.php TestA">TestA4</option> <option value="TestA5.php TestA">TestA5</option> <option value="TestB1.php TestB">TestB1</option> <option value="TestB2.php TestB">TestB2</option> <option value="TestB3.php TestB">TestB3</option> <option value="TestB4.php TestB">TestB4</option> <option value="TestB5.php TestB">TestB5</option> <option value="TestB6.php TestB">TestB6</option> </select><input type="submit" value="Go" id="submit"/> </div> </table> here are the other java scripts ive been using //Show Select option after clicking Radio button: function showSelect() { var select = document.getElementById('Category'); select.className = 'show'; } //Select option, separates the link from Class $(function(){ var select = $('#Category'), options = select.find('option'); $('[type="radio"]').click(function(){ var visibleItems = options.filter('[value*="' + $(this).val() + '"]').show(); options.not(visibleItems).hide(); if(visibleItems.length > 0) { select.val(visibleItems.eq(0).val()); } }); }); $(function() { $("#submit").hide(); $("#Category").change(function() { window.location = $(this).val().split(" ")[0]; if(loc) window.location.href = loc; }) }); and here is the screenshot in Firefox and IE8 respectively.
  24. Hi all- this is my first post here, I've been working with javascript for only a few months and can usually find the answers by googling, but I am kind of stumped on this one. I have a form where I can select toppings for a pizza and when you change the dropdown selector to choose a topping, a javascript function posts to a standalone php file to automatically update the database. It works great in chrome, but I can't seem to get it to work in IE. If I run the standalone script directly in a browser window, it works, even in IE. So I am assuming that my javascript code that posts to the file is not able to post to the file in IE for some reason. Here is the js function trying to post to the form: function updateCart() { var filename = "<?php echo $server;?>update_cart.php"; $.post(filename, $("#cartform").serialize()); alert("file name: " +filename); } The alert pops up and correctly displays the path to the file in both chrome and IE. Does anyone see any obvious reasons why this wouldn't work in IE? thanks for your help, Andy
  25. Hi! I'm making a time laps calculator based off of the equation found http://americandslr.com/2010/10/time-lapse-calculator/ there. I'm completely done with the functional part of it. Now I need to worry about the aesthetic part of it. Here is the code: <?php if (isset($_POST['filming'])) $hour = $_POST['filming']; if (isset($_POST['framerate'])) $framerate = $_POST['framerate']; if (isset($_POST['dtrt'])) $dtrt = $_POST['dtrt']; $half = $hour * 3600; $halftwo = $framerate * $dtrt; $answer = $half / $halftwo; ?> <!DOCTYPE html> <html lang='en'> <head> <title>Timelapse Calculator</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> </head> <body> <div class="well span 5"> <form class="form-horizontal" method="POST"> <fieldset> <!-- Form Name --> <legend><h1><center>Timelapse Calculator</h1></center><br></legend> <!-- Text input--> <div class="control-group"> <label class="control-label" for="filming"><strong>Film Time (in hours)</strong></label> <div class="controls"> <input id="filming" name="filming" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">1 hour would be "1", 1 and a half hours would be "1.5" etc. </p> </div> </div> <!-- Text input--> <div class="control-group"> <label class="control-label" for="framerate"><strong>Frame Rate</strong></label> <div class="controls"> <input id="framerate" name="framerate" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">How fast will it be presented?</p> </div> </div> <!-- Text input--> <div class="control-group"> <label class="control-label" for="dtrt"><strong>Duration</strong></label> <div class="controls"> <input id="dtrt" name="dtrt" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">How long do you want the time lapse to last? <u>IN SECONDS</u></p> </div> </div> <!-- Button --> <div class="control-group"> <label class="control-label" for="submit"></label> <div class="controls"> <input type="submit" class="btn btn-primary btn-large" value="Submit"/> </div> </div> </fieldset> </form> <h2><center><strong><?php echo $answer . " seconds between picture" ?></center></strong></h2> </div> <script src="http://code.jquery.com/jquery.js"></script> <script src="js/bootstrap.min.js"></script> </body> </html> (yes i'm using bootstrap) Here is a screenshot of what it looks like before and after you submit: Before submission: http://gyazo.com/361d109f0af010fcda4d90288b338566 After submission: http://gyazo.com/cf1c2c2089af3f6b4bf349aeab7fc1d4 1. how do I make it round to the nearest tenth? When I used "round($answer, 1);" it crashed my script. 2. How can I make the "seconds between picture" only appear after you press submit? Thanks, I'm a noob. Fisher
×
×
  • 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.