Jump to content

Vorotaev

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by Vorotaev

  1. OK, now I'm confused too as to what you want the rollover to do. If you want the full sized picture to appear on the left when the mouse is placed over the thumbnail, you'd use: [code]// The full size image. <img id="imgfull" src="tile1_full.jpg"> // A sample thumbnail. <img src="tile2_thumb.jpg" onmouseover="imgfull.src='tile2_full.jpg';">[/code] ...as an example.
  2. [!--quoteo(post=362860:date=Apr 8 2006, 05:30 PM:name=niza)--][div class=\'quotetop\']QUOTE(niza @ Apr 8 2006, 05:30 PM) [snapback]362860[/snapback][/div][div class=\'quotemain\'][!--quotec--]I would like to pass the value $adID from the radio buttons [code]<input name='vAd' type='radio' value='$adID'>[/code] to this link here: [code]<a href='edit_add.php?id=$adID'>Edit</a>[/code] But no matter what radio button I choose, when I click the Edit link, the ID doesn't change. Any sugestions? Thanks. [/quote] Unfortunately, what wildteen88 said is correct. PHP parses the page before ever sending it, and has no way to change the ID thereafter. You should use Javascript instead: [code]<script type="text/javascript"> function uplink() {     document.getElementById('ulink').href = 'edit_add.php?' + document.getElementByName('vAd').value; } </script> <input name='vAd' type='radio' value='$adID'> ... <a id="ulink" href='edit_add.php?id=$adID'>Edit</a>[/code] In this example, you would add the ID of "ulink" to the link in question so Javascript can interact with it.
  3. The function mysql_fetch_array will give you an array which contains the last row affected by the query, with the elements of the array being the columns in the affected row. I was sure there was a function that returned more than just the last row affected, but this works for our purposes anyways. In this case you don't need to sort the results at all. You could use ORDER BY column_name DESC in a query to point out that you want the column results sorted by descending order, however. --EDIT-- Oh, yes. The problem. Quite right. Perhaps you should pass the result data to the next form, and find out the ID using mysql_fetch_array on that page.
  4. [!--quoteo(post=363028:date=Apr 9 2006, 01:00 PM:name=SomeGuy1337)--][div class=\'quotetop\']QUOTE(SomeGuy1337 @ Apr 9 2006, 01:00 PM) [snapback]363028[/snapback][/div][div class=\'quotemain\'][!--quotec--] your oviously very inexpiraneced with progrmaing, which is fine, thats why your hear asking questoins. i am not sure what you are trying to do, you need to be more clear. i think you want it that when you press the roll over button to goto a section on your site you want php and mysql to show that content when you press the button? you will have to be more sepcific before anyone can offer any usefull advice. [/quote] Technically it's scripting as opposed to programming. He wants to use a basic rollover; the image changes when you put the mouse on it. He wants to do so with PHP and MySQL, however, which isn't possible for the reasons explained by ToonMariner. A rollover with Javascript is as simple as: [code]<img src="pic.jpg" onmouseover="this.src='new.jpg';" onmouseout="this.src='pic.jpg';">[/code] [Fixed the quotes.]
  5. Out of curiousity, why use two forms? You could use one form, have it contain both the member information and the ad information, and have the script which parses the input query both, one after the other. After the first query, I'd sort the affected rows in descending order to get the last row changed, and grab the ID from that. Then just do the second query.
  6. [!--quoteo(post=363015:date=Apr 9 2006, 12:03 PM:name=me1000)--][div class=\'quotetop\']QUOTE(me1000 @ Apr 9 2006, 12:03 PM) [snapback]363015[/snapback][/div][div class=\'quotemain\'][!--quotec--]when I take out [code]<h1 id="siteName"> </h1>[/code] it quits working so I try to take out just the part of it and it still doesnt work! BTW that 2nd javascript in the page (at the bottom) is in my template page too [/quote] Certain tags won't display if they are empty. The non-breaking space is commonly used in this situation to force the tag to display. That may, or many not, have anything to do with why the sub-menus aren't working.
  7. That's perfect, thank you. ^_^ **SOLVED**
  8. This is probably a n00b question, but how would one go about using PHP to detect the version of MySQL someone is using? Much thanks in advance.
  9. [!--quoteo(post=362628:date=Apr 7 2006, 03:47 PM:name=AdamPGT)--][div class=\'quotetop\']QUOTE(AdamPGT @ Apr 7 2006, 03:47 PM) [snapback]362628[/snapback][/div][div class=\'quotemain\'][!--quotec--] The Options are being generated dynamically using PHP/JS.....even after looking at the page source when everything has been created no <option> tags show up. --Adam [/quote] When using Javascript to dynamically produce code, the changes will not be reflected in the source HTML. The source only shows the page as it was when it was first compiled. Just so you know.
  10. [!--quoteo(post=362904:date=Apr 8 2006, 09:21 PM:name=Gutspiller)--][div class=\'quotetop\']QUOTE(Gutspiller @ Apr 8 2006, 09:21 PM) [snapback]362904[/snapback][/div][div class=\'quotemain\'][!--quotec--] That looks like it might work, but I don't know much about coding other than following peoples instructions. My ad code is provided by an ad company so it's already in a script tag not site url and ad image. Can you help me with what exactly I need to put into the page code to get it to refresh every 30 seconds? [/quote] [code]<script type="text/javascript"> setTimeout("myfunction()",1800000); </script>[/code] The above Javascript would call the function "myfunction" every 1800000 milliseconds -- every 30 minutes. We'll need two extra things: the first is an array of images and their matching links. [code]// Produce two new arrays to hold the information. var banners = new Array(); var links = new Array(); // The banners array holds the URLs of 4 banners. banners[0] = "banner1.jpg"; banners[1] = "banner2.jpg"; banners[2] = "banner3.jpg"; banners[3] = "banner4.jpg"; // The links array holds the matching links for the banners array. links[0] = "http://www.asite.com/"; links[1] = "http://www.anothersite.com/"; links[2] = "http://www.notasite.com/"; links[3] = "http://www.asdfghjkl.com/";[/code] You would then need to have myfunction() look something like this: [code]function myfunction() {     // Update the banner image URL.     document.getElementById('ad').src=banners[i];     // Update the site the banner links to.     document.getElementById('url').href=links[i];     // Increment i so a different banner/link shows next time.     i++;     // If the variable i gets larger than the largest number in our arrays, set it back to 0 (reset the banner rotation).     if(i > 3) {         i = 0;     } }[/code] There are a few problems; one, I can't be sure updating the banner won't steal focus (I haven't tested it). Second, if you don't produce the advertisement code yourself, you can't control if they add an ID to the banner or link. No ID, no updating with Javascript. :(
  11. When you say it's not working, do you mean you don't receive an alert for an invalid email address, or the form doesn't submit? The latter would likely be because you don't have an ACTION property set on your form telling it where to send the information. Also, the above isn't very strong validation. I could use aa.@ as my email address, and it would go through. It would be better to use a regex like: [code]var str = subscribe.email.value; if (str.match(/\b^[a-zA-Z0-9_.]+@[a-zA-Z0-9]+\.[a-zA-Z]{2,4}$/\b) {     // Email address is valid } else {     // Email address is not valid }[/code]
  12. [!--quoteo(post=362866:date=Apr 8 2006, 05:59 PM:name=dbrimlow)--][div class=\'quotetop\']QUOTE(dbrimlow @ Apr 8 2006, 05:59 PM) [snapback]362866[/snapback][/div][div class=\'quotemain\'][!--quotec--] Is this a "blanket" conversion of all PHP? I have over 800 php pages and only want to convert specific files. [/quote] Yes, that would convert URLs for all PHP files. If you wanted to select only a handful of files, it would be better to use: [code]redirectpermanent /oldpage.php http://www.somesite.com/newpage.html [R][/code] Bearing in mind that the former link [u]should[/u] be a path.
  13. [!--quoteo(post=358958:date=Mar 27 2006, 01:51 PM:name=dbrimlow)--][div class=\'quotetop\']QUOTE(dbrimlow @ Mar 27 2006, 01:51 PM) [snapback]358958[/snapback][/div][div class=\'quotemain\'][!--quotec--] I changed @ 10 of my php pages back to html. I revised the pages with pure css layout and converted the navbar includes insert to an external jscript navbar write. What I want to do is have anyone who bookmarked the php versions of the pages auto-redirected to the new html versions. I am temporarily using a redirect link within the php pages themselves. Thanks, Dave [/quote] Place the following in the .htaccess file (if mod_rewrite is available): [code]RewriteEngine on RewriteRule ^/([a-z][A-Z][0-9]-/+).php$ $1.html [R] [/code] That should redirect all .php requests to the respective .html equivalent (page.php should become page.html, index.php should become index.html, guestbook.php should become guestbook.html, and so forth).
  14. [!--quoteo(post=362819:date=Apr 8 2006, 12:35 PM:name=Trevors)--][div class=\'quotetop\']QUOTE(Trevors @ Apr 8 2006, 12:35 PM) [snapback]362819[/snapback][/div][div class=\'quotemain\'][!--quotec--] Heya all i got a small question on how to paste a text when you single click it and paste it into a textbox using javascript. Im trying to create a "message function" on one of my websites but i have never been any good at javascripting. I got one box where i list a persons friends and one send message form, when someone clicks on one of the names on the friendlist it should paste into the send to box. Is there any easyway doing this? Best Regards Trevors [/quote] [code]// Function to paste friends. <script type="text/javascript"> function pastefr(friend) {     document.getElementById('recipient').value = document.getElementById(friend).innerText; } </script> // Example of friends list. <select size="4" onchange="javascript: pastefr(this.options[selectedIndex].id)">     <option id="f1">Michael87</option>     <option id="f2">xx_Hot_Debbi_xx</option>     <option id="f3">z3r0_t0n</option>     <option id="f4">Amy_Winston</option> </select> // Example of form. <form action="sendmessage.php" method="POST">     <input type="text" size="16" id="recipient" /><br />     <textarea cols="40" rows="5" id="message"></textarea><br />     <button type="submit">Send message</button> </form>[/code] All the better if you have the screenname listed as a value in the <option> tag. Of course, this can be modified to use something other than a SELECT tag, but you get the gist.
  15. [!--quoteo(post=362805:date=Apr 8 2006, 10:35 AM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Apr 8 2006, 10:35 AM) [snapback]362805[/snapback][/div][div class=\'quotemain\'][!--quotec--] That's not right. That selector would say "apply the same thing to the something class, the td tag, and the th tag." That wouldn't work, would it? [/quote] My understanding is that was what was desired... to have all three (TD, TH, and anything with the "something" CLASS) share the same attributes. Hence why they were all listed together on the same line. I may be mistaken. If you desire only TD and TH tags with the CLASS of "something" to share properties, you could use: [code]TD[class=something], TH[class=something] { stuff }[/code] [!--quoteo(post=362806:date=Apr 8 2006, 10:43 AM:name=EriRyoutan)--][div class=\'quotetop\']QUOTE(EriRyoutan @ Apr 8 2006, 10:43 AM) [snapback]362806[/snapback][/div][div class=\'quotemain\'][!--quotec--] ... okay, just to make things easier... (?) Is there somewhere that gives good help on selectors? I've looked around, and they only give the basics, or just kind of... expect you to know it. ><; I think .st td,.st th{stuff} worked... might be wrong, tho... I'll go check... and as for the table, I know it automatically updates to the widest element, but the problem is that I've got a page that dynamically updates its pictures (all of which have different widths) (go PHP!) I want to leave it so that it automatically resizes, but without the chance of the scrollbar at the bottom if they're using lower resolutions... other options would be appreciated. -smiles- [/quote] I like [a href=\"http://www.w3.org/TR/REC-CSS2/selector.html\" target=\"_blank\"]the W3C page[/a], but it's rather technical. You could try [a href=\"http://css.maxdesign.com.au/selectutorial/\" target=\"_blank\"]this tutorial[/a]. As mentioned, the only way I know of to prevent the page from scrolling while having the table snap to the width of the content is MAX-WIDTH. MAX-WIDTH will not allow the table to expand past the given size constraint, but the table will resize itself automatically up until that point. Internet Explorer doesn't support MAX-WIDTH though, so it may be moot.
  16. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]For the first one, just do this: .something td {} .something th{}[/quote] Doing that could produce a lot of redundant CSS, especially if a lot of elements are being combined, or there are a lot of properties required for each. [!--quoteo(post=362703:date=Apr 7 2006, 09:44 PM:name=EriRyoutan)--][div class=\'quotetop\']QUOTE(EriRyoutan @ Apr 7 2006, 09:44 PM) [snapback]362703[/snapback][/div][div class=\'quotemain\'][!--quotec--]First off, Hi!! Okay, now that that's over with... First thing I was asking: multiple tags. Is there a way to do something like... .something td{stuff} th{stuff} cause every time I try it ends up making the th stuff default, or it dosen't recognize it... Secondly... I want to make a table width automatic, but not over 100% (I don't want a scroll bar on the bottom) ... ... Heeelp? Please? [/quote] Are you sure that's what you want to do? .something will apply the style to anything that has the CLASS "something", regardless of the element. td{stuff} will apply the style to any TD tag. th{stuff} will apply the style to any TH tag. But you've neglected to specify what style should be used for the "something" CLASS. Might you instead want to do this: [code]<style type="text/css"> .something,td,th{stuff} </style>[/code] ...which would apply the style to any TD or TH tag, as well as any element with a "something" CLASS? Table width is automatically adjusted to the width of the largest element inside it. There is a CSS2 property called MAX-WIDTH, but Internet Explorer does not support it -- even Internet Explorer 7.0, which is only available to Windows XP users. [a href=\"http://www.svendtofte.com/code/max_width_in_ie/\" target=\"_blank\"]Here[/a]'s a site which has a trick using Javascript to force IE to adopt a MAX-WIDTH type of thing, but not everyone has Javascript enabled, so I wouldn't rely on it too heavily.
  17. I don't think Flash adds an ID by default. You'd just add one yourself, as so: [code]<embed id="ID" ... >[/code] ...but that's an aside. As for how to update the banner, there are a few options. You could do something like this: [code]<div id="ads">     <a href="www.somesite.com"><img src="ad.jpg" /></a> </div>[/code] ...where your ad is put inside a DIV, then use the DOM property of innerHTML to change the DIV as needed. As so: [code]document.getElementByID('ads').innerHTML="<a href=\"www.newsite.com\"><img src=\"newad.jpg\"></a>";[/code] Or, you could assign a unique ID to the anchor tag and the image tag, and update them using the href and src properties, respectively: [code]document.getElementByID('link').href="http://www.asite.com/"; document.getElementByID('banner').src="theadbanner.gif";[/code] You would need to use the setTimeout function to cause the information to update either way, but it isn't a very complicated thing to do. It's commonly used for clocks and whatnot.
  18. Seems to be the problem is that each form would need its own submit button, and the submit button would only submit the contents of the associated form. Or do you mean to say that even if you use the other submit buttons associated with different forms, they do not submit/the information does not get through? Also, you should validate the submitted information before dumping it into a variable for use by a script. Never, ever trust user supplied information.
  19. [code] // Place a number in pixels where # is. <table style="width: #px;">[/code] Um... yeah? That seems to me to be the simplest and most effective way to create a fixed-size table. Unless I'm misunderstanding your question, in which case please feel free to clarify.
  20. Problem is, it's the intentional design (for accessibility reasons) that a frame gets focus when loaded. Every time the page refreshes, the page is loaded and gets focus. For Flash games that don't use the keyboard, this doesn't matter, since focus is restored when the mouse is clicked. But for games that use the keyboard, Flash won't register commands until focus is restored to the game. What's worse, I'm not sure you can change focus between frames. You could try this: [code]// Put this in the IFRAME(s). <head> <script type="text/javascript">     function setfocus() {         // Set ID to the ID associated with the embedded Flash object.         document.getElementById('ID').focus();     } </script> </head> <body onload="javascript: setfocus();"> ... </body>[/code] ...no guarantees it will work, though. You could also change the way advertisements are changed, so that IFRAMES aren't used. Perhaps using a Javascript to change the banner and URL after a set delay.
  21. Your page has two BODY tags. It really shouldn't... anyways. Firefox is definitely showing the border. It's just showing only the outside part as red. [code]<table width="780" height="834" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#FF0000" bgcolor="#000000">[/code] Opera ignores the bordercolor setting altogether, defaulting to gray. Firefox colours the outside border, but leaves the inner border as default gray. Internet Explorer will color the entire border red. You could try removing the cellspacing. Or using CSS to create the border instead.
  22. I may be mistaken, but I believe you can only specify a target that exists on the current page (or frameset, if frames are used), or a target such as _parent, _top, or _blank. What you might need to do is send the URL of the IFRAME to the second page via a form, and use a Javascript to catch and load the URL in the IFRAME when the page is loaded. -EDIT- Please note that you would absolutely want to validate any URL passed in such a fashion before loading it in an IFRAME. Javascript has a regex engine, that would be a good start.
  23. [!--quoteo(post=362010:date=Apr 5 2006, 02:40 PM:name=asgsoft)--][div class=\'quotetop\']QUOTE(asgsoft @ Apr 5 2006, 02:40 PM) [snapback]362010[/snapback][/div][div class=\'quotemain\'][!--quotec--] How can I make the textboxes empty when you click on them? Is there a way of resetting the value of the drop down menue when it is hidden? Also why doesn't it show the textbox tag in the html of the file when it is showing them? [/quote] Question 1: Add [b]onfocus="this.value=''"[/b] to the input fields to make them clear when someone clicks on them, or uses the tab key to navigate to them. Please note the use of " and '; you [u]must[/u] use alternating quotations, or the form will think the first ' after the = is the closing '. Question 2: [b]document.getElementById('item_count').options['[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]ID[!--colorc--][/span][!--/colorc--]'].selected=true[/b] Please notice the highlighted "ID" in the above code. You need to assign the <option> the menu resets to an ID, and place it where shown. Question 3: The HTML source only shows what was there when the page was compiled. Any changes to the code by Javascript after that will not appear in the source code.
  24. Ah, that sounds perfect. Thanks very much for your help. ^_^
  25. I'm trying to write a simple membership system, and for security's sake, I'd like to track the various IP addresses used to access a given account. I obviously don't know what the IP addresses will be in advance, nor do I know how many of them will be used for an account. If the person uses dial-up, it could change with every single visit. If I knew there would be only one IP address, the situation would be simple; each row would contain a member's screenname, their miscellaneous information, and their IP address all bundled together nice and simple like. But since each member may need to store many IP addresses, I need something a bit more flexible. MySQL doesn't seem to have any kind of array data type. The closest thing I could find was LONGTEXT, which I could then use to produce a series of IP addresses in CSV format, which I in turn could use a PHP function like explode() to break into an array to work with. It seems like there should be a better way to handle it though. Any suggestions or information would be appreciated. Thanks in advance.
×
×
  • 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.