Jump to content

colap

Members
  • Posts

    302
  • Joined

  • Last visited

Everything posted by colap

  1. Can you please explain your problem in details?
  2. No, i want to put/place a web page in that div,not only "Hell world". And it will happen after clicking the button. Can someone give some clue for that?
  3. If i click a button then a new page will come in a div. Is it possible with php? I have tried this but it doesn't work. <?php if(isset($_POST['nmdiv'])) { echo "<div class=\"cldiv1\" id=\"iddiv1\"><?php include(\"copyright.php\")?></div>"; } ?> <html> <head> <title>phptest</title> <script type="text/javascript" language="javascript"> function makediv(){ var tmp=document.getElementById("iddiv1"); tmp.style.border="solid"; tmp.style.position="absolute"; tmp.style.left="300px"; tmp.style.top="100px"; tmp.style.width="400px"; tmp.style.height="200px"; } </script> </head> <body> <form method="post"> <input type="button" name="nmdiv" value="click" onclick="makediv()"/> </form> </body> </html>
  4. include("database_connector.php"); $admin_id = $_POST['admin_id']; $admin_password = $_POST['admin_password']; $cmd1=mysql_query("select * from admin where admin_id='$admin_id' AND password='$admin_password'"); //$row1=mysql_fetch_array($cmd1, MYSQL_NUM); //$row1=mysql_fetch_row($cmd1); $count1=mysql_num_rows($cmd1); if($count1==1) {
  5. Can you please give link for that or sample example?
  6. I have a main div. javascript code has been added to create new div. If i type in a textarea and click "ok" button a new div will be created containing that message from textarea. Now if i reload the page the newly created divs are gone. I want to save this new divs with that page. If i reload that page or open that page with another browser or from another browser window the web page will contain those divs. Is it possible to do this?
  7. Thank you.Solved.
  8. I have also tried with 'my'.But didn't work. Probably there is a mistake with removeElement() function calling but i can't find it.
  9. Here we go: newdiv.innerHTML = 'Element Number '+num+' has been added! <a href=\'#\' onclick=\'removeElement('+divIdName+')\'>Remove the div "'+divIdName+'"</a>'; Probably something is wrong here.But i can't find it. How would i add a button in that new div? I want to test with a button instead of <a href> link.
  10. Changed it.But it doesn't work. <html> <head> <title> "Javascript Testing"></title> <script type="text/javascript" language="javascript"> function addElement() { var ni = document.getElementById('myDiv'); var numi = document.getElementById('theValue'); var num = (document.getElementById('theValue').value -1)+ 2; numi.value = num; var newdiv = document.createElement('div'); var divIdName = 'my'+num; var writediv=document.getElementById('idrgt'); writediv.innerHTML="divIdName: "+divIdName+"<br/>"; newdiv.setAttribute('id',divIdName); newdiv.innerHTML = 'Element Number '+num+' has been added! <a href=\'#\' onclick=\'removeElement('+divIdName+')\'>Remove the div "'+divIdName+'"</a>'; ni.appendChild(newdiv); } function removeElement(divNum) { var d = document.getElementById('myDiv'); var olddiv = document.getElementById('DIV'+divNum); d.removeChild(olddiv); } </script> <style type="text/css"> div.div1{ width:400px; height:70px; background-color:green; } div.rgt{ position:absolute; left:500px; top:300px; width:400px; height:70px; background-color:blue; } div.del{ position:absolute; left:500px; top:100px; width:400px; height:70px; background-color:red; } </style> </head> <body> <div class="div1" id="myDiv"> <textarea rows="2" cols="20"> Comment; </textarea> <input type="hidden" value="0" id="theValue" /> <input type="submit" value="Submit" onclick="addElement()"/> </div> <div class="rgt" id="idrgt"> </div> <div class="del"> </div> </body> </html>
  11. Adding divs work,but removing divs don't work. http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/ <html> <head> <title> "Javascript Testing"></title> <script type="text/javascript" language="javascript"> function addElement() { var ni = document.getElementById('myDiv'); var numi = document.getElementById('theValue'); var num = (document.getElementById('theValue').value -1)+ 2; numi.value = num; var newdiv = document.createElement('div'); var divIdName = 'my'+num; var writediv=document.getElementById('idrgt'); writediv.innerHTML="divIdName: "+divIdName+"<br/>"; newdiv.setAttribute('id',divIdName); newdiv.innerHTML = 'Element Number '+num+' has been added! <a href=\'#\' onclick=\'removeElement('+divIdName+')\'>Remove the div "'+divIdName+'"</a>'; ni.appendChild(newdiv); } function removeElement(divNum) { var d = document.getElementById('myDiv'); var olddiv = document.getElementById(divNum); d.removeChild(olddiv); } </script> <style type="text/css"> div.div1{ width:400px; height:70px; background-color:green; } div.rgt{ position:absolute; left:500px; top:300px; width:400px; height:70px; background-color:blue; } div.del{ position:absolute; left:500px; top:100px; width:400px; height:70px; background-color:red; } </style> </head> <body> <div class="div1" id="myDiv"> <textarea rows="2" cols="20"> Comment; </textarea> <input type="hidden" value="0" id="theValue" /> <input type="submit" value="Submit" onclick="addElement()"/> </div> <div class="rgt" id="idrgt"> </div> <div class="del"> </div> </body> </html>
  12. else if($submitted_by_admin=$_POST['submitted_by_admin']=='yes_admin') { // echo "admin:".$submitted_by_admin; include("database_connector.php"); $admin_id = $_POST['admin_id']; $admin_password = $_POST['admin_password']; $cmd1=mysql_query("select *from admin_info where user_name='$admin_id' AND password='$admin_password'"); $row1=mysql_fetch_array($cmd1); ****************/error $count1=mysql_num_rows($cmd1); ****************/error Error is shown on last two lines.
  13. Should i edit conditional statements in the <?php ?> block to make it more efficient code? How can i make this code more efficient? <?php session_start();?> <?php if($_POST['ins']){ header('Location:stp.php'); } if($_POST['upt']){ header('Location:byte.html'); } ?> <html> <head> <title>Welcome</title> </head> <body> <form method="post"> <input name="ins" type="submit" value="INSERT"/> </form> <form method="post"> <input name="upt" type="submit" value="UPDATE"/> </form> <form method="post"> <input name="del" type="submit" value="DELETE"/> </form> </body> </html>
  14. Why do they all work? document.location="byte.html"; document.location.href="byte.html"; window.location="byte.html"; window.location.href="byte.html"; location.href="byte.html";
  15. If i click the button it's not redirected to new page. Where would i change in my code? Where is the error?
  16. <script type="text/javascript" language="javascript"> function thatpage(){ document.URL="byte.html"; } </script> <form> <input name="ins" type="submit" value="INSERT" onclick="thatpage"/> <input name="upt" type="submit" value="UPDATE"/> <input name="del" type="submit" value="DELETE"/> </form>
  17. It works.But how would i use header() here instead of action=""? <form action="byte.html"> <input name="ins" type="submit" value="INSERT"> </form> <form action="stp.php"> <input name="upt" type="submit" value="UPDATE"> </form>
  18. Why isn't javascript reliable? I have also tried this.But it's not working. <form > <input name="ins" type="submit" value="INSERT" onclick="location.href='byte.html'"> <input name="upt" type="submit" value="UPDATE"> <input name="del" type="submit" value="DELETE"> </form>
  19. No. If i click insert button,it will redirect to insert.php file,similarly update button-->update.php delete button -->delete.php I don't want to display the yourpage.php file for the click event of these three buttons. I'm trying "different page display for different button's click event".
  20. <form> <input name="ins" type="submit" value="INSERT"> <input name="upt" type="submit" value="UPDATE"> <input name="del" type="submit" value="DELETE"> </form>
  21. I want to navigate/redirect php page with html buttons. Can anyone post sample code? Html button navigation with click event. (Javascript if necessary)
  22. I have four buttons on a php page. If i click a button it will redirect to different php pages. How would i do that with php?
  23. That was written in Adobe Dreamweaver , now i'm editing with vim editor in linux. What should i do now?
×
×
  • 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.