Jump to content

Search the Community

Showing results for tags 'onclick'.

  • 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

Found 11 results

  1. I had such a class : class NodeElement { no; x; y; tre; tdno; tdx; tdy; cbox; nodesArray; nodesTable; selected; constructor( x, y,nodesArray, nodesTable) { nodeCounter++; this.no = nodeCounter; this.x = x; this.y = y; this.nodesArray = nodesArray; this.nodesTable = nodesTable; //create elements this.tre = document.createElement("tr"); this.tre.id = "row"+this.no; this.tdno = document.createElement("td"); this.tdno.id = this.no; this.tdno.innerHTML = this.no; this.cbox = document.createElement("input"); this.cbox.type="checkbox"; this.cbox.id="cbox"+this.no; this.cbox.value=this.no; this.cbox.name="cbox"+this.no; this.cbox.setAttribute('onclick','select(this)'); this.tdx = document.createElement("td"); this.tdx.id="tdx"+this.no; this.tdx.innerHTML = this.x; this.tdy = document.createElement("td"); this.tdx.id="tdy"+this.no; this.tdy.innerHTML = this.y; } } I want to pass complete class object(i.e instantiated one) to a function select() as parameter when I click(i.e. checked the checkbox object of the class instance). My question is that line : this.cbox.setAttribute('onclick','select(this)'); I tried that too : this.cbox.setAttribute('onclick','select("'+this+'")'); but not worked. I could no achieve to pass neither checkbox nor the class object(NodeElement) to function select() as parameter. How can I do that?
  2. I've got a bit of jQuery that is getting the bit of data that I want to search the page for. This is posted below. $(".pagelink").click(function(){ var myClass = this.className; var number = myClass.substr(myClass.length - 1); }); This bit is working ok. It gets the last bit of the element's class name which is a number incremented by the PHP that echoes it out. Now I want to search the page for a div that has a class that contains that var number. There will be a div somewhere on the page with a class that contains that number. It will be called either row0, row1, row2, row3 etc etc. The div is not a descendant element of the pagelink class, it is somewhere else so I don't think the find() variable is suitable. Any help will be greatly appreciated, thanks!
  3. What's wrong with this simple script to call 2 functions: if (up < max){ lower.onclick=min_function; } else if (up > min) { lower.onclick=max_function; }
  4. Hi all, this is my first post. Be gentle! I'm trying to peform a small hack on a Joomla component to better suit by needs... Currently the 'trigger' has an event attached to it, that opens a browser window, the event looks like this (it works fine): $eventprnt = 'onclick="window.open(\'index.php?myurl ='.$item->id.'\')" '; I want to change the function from 'window.open' to 'window.location.href', but the quotes and semicolons thing is killing me (I keep getting T_STRING errors). I've included an example of one of my attempts to give you all a good laugh: $eventprnt = 'onclick="window.location.href ='$index.php?myurl ='.$item->id.'"'; As you can probably see, I could be here for a while unless I ask for help... I've done a lot of reseacrh, and it sounds like I need backslashes, quotes... All sorts of stuff. Unfortunately it's all Chinese to me. If you can give me a pointer, that would be a real help. Mark
  5. Hi! I am new at this,so can anyone show or tell me how can i make a text that changes color all the time when i click on it.When first time i click on the black text -> it changes to Red,when i click again it become black again and if i click again it becomes Red and so on,This in a circle.How can i do this? Thanks for the help and please no flaming i am new yet,and didn't found my answer on the net yet... Any help or idea welcome!
  6. Hi I created php function that creates table. I want to create onclick evant on <td> that calls php function showinfo($year,$month,$day). Variable $list_day is inserted when table is generated(local variable for function). Variables $year,$month are global variables. This is how I created <td>: $calendar.= '<td onclick=showinfo($year,$month,'.$list_day.'); class="calendar-day_used">'.$list_day.'</td>'; This is what is generated from above code: <td onclick="showinfo($year," $month,="" 21);="" class="calendar-day_used2">21</td> What am I doing wrong??? Thanks in anvance
  7. I have checkbox function that creates a checkbox list from my database. I also have a map that I want onclick to check the checkbox align with that section of the map. So if you click Bominvile on the map the checkbox for Bominville gets checked/unChecked. [FUNCTION CALL] (From db.php) / This will create a CHECK BOX based on the property/value pairs in table AND the toggle all checkbox. function buildCheckBox($table, $prechecked) { $conn = db_connect(); // establish connection $sql = "SELECT property, value FROM ".$table.""; $results = pg_query($conn, $sql); //THIS LOOP ONLY RUNS ONCE ON PAGE LOAD. JUST TO DISPLAY // THE REORDS IN THE CITY DB TABLE. while ($record = pg_fetch_array($results)) { $checked = ($prechecked == $record['value'])?"checked=\"checked\"":""; echo '<input type="checkbox" name="'. $table.'[]" ' .$checked.' value="'. $record['value'] .'">'. $record['property'] .'<br/>'; } //echo "show me whats record ". $record['property']. "<br/>"; } [/FUNCTION] <script language="javascript"> function myclick(whichone) { if (document.getElementById(whichone).checked == true) { document.getElementById(whichone).checked = false; } else { document.getElementById(whichone).checked = true; } } </script> <tr> <td class="left"> <input type="checkbox" id="city_toggle" onclick="cityToggleAll();" name="city[]">City Toggle All<br/> <!-- FUNCTION CALL TO LOOP THROUGH TOGGLING CHECK BOXES ON/OFF--> <?php echo buildCheckBox('city', $selected_city);?> <input type="checkbox" id="city[]"><br> </td> <td><img src="pictures/durham_mapgoodbeforewhitby.png" alt="durham_map" width="417" height="340" usemap="#map1"> <a href="#" onClick="myclick('city[]')"> <map name="map1"> <area shape="poly" coords="193,207,284,207,391,214,190,287,260,299,300,307,344,310,389,322" href="#" id="city[]" title="Bowmanville" alt="Bowmanville" /> </map> </a><br> </td> </tr>
  8. Hello, I am building a navigation bar with sub menus which appear when the main item is clicked and disappear when the user clicks elsewhere. I have read numerous posts concerning this topic but I'm not sure how to implement it. My code is as follows: topNav.js <script> var timeout = 50; var closetimer = 0; var ddmenuitem = 0; // open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if (ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if (closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // need to somehow close layer when click-out </script> Html <body> <div id="main_nav"> <ul id="nav"> <li class="nav"><a href="#" onclick="mopen('m1')"> <span class="nav_parent">CONTACT US</span></a> <div id="m1"> <a href="#">General Inquiries</a> <a href="#">Request a Quote</a> <a href="#">Submit Plans</a> <a href="#">Submit Photos</a> </div></li> </ul> </div> </body> An example of this is at http://jsfiddle.net/schwiegler/t859A/21/
  9. Hi Guys I am trying to set an onclick value based on the value of a select menu. The function I have at the moment is function setSize() { if (document.getElementById('size').value >0) { var size= document.getElementByID('size').value; document.getElementById('btnAddToCart').options.onClick = "window.location.href='<?php echo $cart_url; ?>&s=';"; } else { document.getElementById('btnAddToCart').options.onClick = "window.location.href='<?php echo $cart_url; ?>';"; } } Basically, if a size is required for an item then the value of the onclick needs to be window.location.href='<?php echo $cart_url; ?>&s=size variable If no size is required then the value needs to be window.location.href='<?php echo $cart_url; ?>' I am just not sure how to achieve this.
  10. Hey there, I've been dabbling with some Javascript and I've been okay adding code in where I wanted until I came to the last part of this executing script. Basically what happens here is the Button Play Flash Game Click Here will pop open a hidden Div that shows places that they can vote at to play the game... Then what I need to happen is after the Vote Click a count down timer pops up to force a 10-15 second wait before the ShowDiv appears. I found that the script immeditately runs once the page is loaded and I have it at a 10second wait, so if I wait 10 second before clicking on anything I'll find that the Div Will Already be shown but if I quickly move through the vote it will take the 10 seconds to appear. So again what I need is for it to start the count down AFTER the vote has been cast. I'm totally newbish when it comes to Javascript I'm just good at creating frankeinsteined code by researching snippits. So please make sure you take it slow with me on this, anything outside the box of copy and paste and it might confuse the hell out of me unless you can explain a tiny bit of whats going on! I appreciate it - here's the code I'm currently using: <script type="text/javascript"> function toggle(obj){ var obj=document.getElementById(obj); if (obj.style.display == "block") obj.style.display = "none"; else obj.style.display = "block"; } </script> <br> <a href="javascript: void(0);" onClick="toggle('q1')"><center>Play Flash Game Click Here:</center></a> <div id="q1" style="display:none;"><center> <a href="javascript:ShowDiv()" onclick=window.open('http://site1.com')>Vote Site #1</a> <a href="javascript:ShowDiv()" onClick=window.open('http://site2.com')>Vote Site #2</a></div> <div id="HiddenDiv" style="display:none;"><div id="my_div"></div> <script type="text/javascript"> (function (){ var element_id = 'my_div' ; var link_text = '<center>(FLASH GAME CODE EMBEDDED HERE)</center>'; //link code var time = 10; setTimeout(function(){document.getElementById(element_id).innerHTML = link_text;},time*1000); })(); </script></div> <script language="javascript"> function ShowDiv() { document.getElementById("HiddenDiv").style.display = ''; } </script>
  11. Hi all, I am trying to make sure that a user cannot move on unless they select a radiobutton, but unfortunately it's not working. I used same function with checkbox in my other page and it works perfect but i don't know why it is not working here Btw, this is not inside a form (as in other page I have used inside the form) PLEASE HELP echo "<td class='kooltd'><input type = 'radio' name = 'rFlight' value = '".$row['flight_id']."'></td>"; echo "<input type='submit' id='button1' name='booking' value='Make Booking for the Selected Flight' onclick='if(!this.form.rFlight.checked){alert('You must select a flight.');return false}'/></br>";
×
×
  • 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.