Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. It appears that there are a number of solutions here:http://www.google.com/search?hl=en&lr=...p+PDF+converter
  2. Maybe you could submit all of your form data with a POST and then look into URL rewriting to change the URL the user sees in the address bar of the browser. If you search through this forum, you should see a number of posts about URL rewriting.
  3. Like Prateek said in the beginning, it's not possible to add an image to an alert, confirm, or prompt box. You'll have to either use a div and position it so that it appears to be above the rest of your content (like Prateek suggested) or you'll have to open up a new browser window to display your message.There are a number of window.open scripts available. One of them is here:http://w3schools.invisionzone.com/index.php?showtopic=9500
  4. You can look into using execCommand() to do this fairly easily in IE, but there are some issues, it appears, with doing this in Firefox.This Google search may help.
  5. Make sure that there aren't any html tags (including <script></script>) in your external javascript file and make sure that you remember to close your script element with a separate </script> tag.This works: <script type="text/javascript" src="myfile.js"></script> This doesn't: <script type="text/javascript" src="myfile.js" /> If this doesn't help, you'll probably have to post your code.
  6. jesh

    table background image

    I remember some other folks on here mentioning in other posts that IE doesn't apply styles to empty td cells. Try doing this instead:<td width="46%" class="some"> </td>
  7. If you aren't using inline styles for these elements, you could try something like this: document.getElementById('extraRow_' + i).setAttribute("style", "_display: table-row;"); EDIT: Of course, this doesn't work in IE
  8. jesh

    Web Spider

    This article was written for C# and ASP.NET, but you may be able to look past the code and read the article for a decent explanation on how a spider works (and is built).http://www.codeproject.com/aspnet/Spideroo.asp
  9. Maybe you could use javascript to change the action for your form just before submitting so that the userid is passed as a query string while the form itself is submitted via POST. Maybe something like this: <form action="mypage.php" method="POST" onsubmit="updateAction(this);"><input type="text" id="userid" /><input type="password" id="password" /><input type="submit" /></form><script type="text/javascript">function updateAction(obj){ var userid = document.getElementById("userid").value; obj.action += "?userid=" + userid;}</script>
  10. It may be because your column name has a space in it. Either update your column names so that there aren't any spaces (e.g. "PhoneNumber") or - some MySQL expert, please correct me if I'm wrong - try putting ` around the column names in your query: INSERT INTO person (Name, `Phone Number`, `Email Address`, `Shirt Size`, Grade, HonorsAP, GPA, Transportation, Why)VALUES
  11. All the code to build an xmlhttp object is in the AJAX tutorial:http://www.w3schools.com/ajax/default.aspIf you feel you need to skip ahead, it's on this page:http://www.w3schools.com/ajax/ajax_xmlhttprequest.aspI'd recommend going through the entire tutorial though, it's short enough.
  12. Here's an example in VB:http://www.w3schools.com/aspnet/aspnet_dbconnection.aspAnd here's an example in C#:http://www.codeproject.com/cs/database/Dat...WithAdoNet1.asp
  13. It's useful anytime you need to look in a string for a particular pattern.Most often, it's used to validate user input (like in specialguy's example). You can use it to make sure a user typed in a date in a correct format, or an email, or a phone number, or a UPC off of a product, or a zip/postal code.But it's a powerful tool and can be used for many other purposes.
  14. If you are generating the table rows from within a for loop, you can use the index of the loop and the modulus operator to determine which css class to use for your row: for(i = 0; i < length; i++){ if(i % 2 == 1) { $cssclass = "AltRow"; } // do your table row building...}
  15. Hmm, I seem to have solved it using nested while loops (uggh).If you're interested, here is the appropriate snippet: // I had already had code that replaced all of the attributes// within a [attr][/attr] block so a typical tag would look like:// <img[attr]src="circle.gif" alt="" width="5" height="5"[/attr] />var attrgroup = /\[attr\].*?\[\/attr\]/;var attrpair = /(\w+)="(.*?)"(.*)/;var groupmatch, pairmatch, temp;while(groupmatch = html.match(attrgroup)){ temp = groupmatch[0]; temp = temp.replace(/\[\/?attr\]/g, ""); while(pairmatch = temp.match(attrpair)) { temp = temp.replace(attrpair, " [name]$1[/name]=\"[value]$2[/value]\"$3"); } html = html.replace(attrgroup, temp);} html = html.replace(/\[name\]/g, "<span class=\"attrname\">");html = html.replace(/\[value\]/g, "<span class=\"attrvalue\">");html = html.replace(/\[\/(name|value)\]/g, "</span>"); If you know of a better way, please let me know.
  16. The parentheses are for grouping. If your regex was "do(ugh)nut" and you ran a match against some string ("I like doughnuts!"), match $0 would be "doughnut" and match $1 would be "oug". If you wanted to make "oug" optional, it'd look something more like "do(ugh)?nut" or maybe even like "do(?:ugh)?nut".A regular expression of "^Sniffy$" would only match "Sniffy". It would not match any of the following:"Sniffy posted this.""I heard Sniffy say...""sniffy"The ^, in this context, means only match at the start of the string and the $, in this context, means only match at the end of the string.The // is how you declare a regular expression in javascript. /test/ is a valid declaration for a regular expression that matches "test". Throwing a "g" on the end of that makes the regular expression global, meaning it will attempt to make more than a single match: /test/gIn the post that you mention, I wrote: /\[b\]/gThe "\", in this context, is an escape character. It makes it so the the regular expression engine treats the character following that as a regular character instead of something special. It's similar to escaping double quotes in strings: "This is a \"string\"". In regular expressions, the [] indicates a set of possible characters. For example, [a-zA-Z] will match any upper- or lower-case letter. [aeiou] will only match vowels. So, if you need to actually match the "[" character, you need to escape it: "\[".I hope this helps a bit.
  17. 2) Check out this page, it explains how to get what the user has selected:http://www.quirksmode.org/js/selected.html3) It's probably just a replace: // replace [b] with <b>content = content.replace(/\[b\]/g, "<b>");// replace [/b] with </b>content = content.replace(/\[\/b\[/g, "</b>");
  18. I've begun playing around with building a code display/syntax highlighter control, similar to the idea of what is here in the forums when you use a SQL box to display SQL: SELECT * FROM mytable I've made the one for javascript and it works beautifully. I've now moved on to the XHTML highlighter and I'm running into the problem of highlighting tags that have multiple attributes. I've got it looking something this: case "html": // get start tags var starttagreg = /<(\w+)(.*?)>/g html = html.replace(starttagreg, "<[tag]$1[/tag]$2>"); // and end tags var endtagreg = /<\/(\w+)>/g; html = html.replace(endtagreg, "</[tag]$1[/tag]>"); // now to style the attributes var attrreg = /\[\/tag\]\s(\w+)="(.*?)"/g html = html.replace(attrreg, "[/tag] <span class=\"attribute\">$1</span>=\"<span class=\"value\">$2</span>\""); // and to style the tag names var keywordreg = /\[tag\](\w+)\[\/tag\]/g; html = html.replace(keywordreg, "<span class=\"tag\">$1</span>"); break; Anyone have any suggestions on how to loop through (either with a for loop or using RegExp) all the attributes in an HTML tag so I can wrap it in a span for styling? Also, anyone know why my / is disappearing in the img tag?Thanks!EDIT: Hmm, nevermind about the missing "/" in the tag, I sorted that out. Still need help on the other thing though
  19. I'm no XML expert, but it may be the és in your XML.When I save your XML as a file on my computer and then open it in Firefox, the és turn into ?s:<UserName>Mark Val�</UserName>However, when I view it in IE, I'm returned with this message:
  20. jesh

    ajax functions...

    Hah!In javascript, you can write a function which has just about any name you desire. Just knowing the name of the function, unfortunately, isn't going to tell you what that function does. We'd have to see the code to help you with that.
  21. What if instead, you used two columns? This would return all public messages: SELECT * FROM `chat` WHERE `type` = 'public' ORDER BY id DESC And this would return all private messages for a particular user: SELECT * FROM `chat` WHERE `type` = `private` AND `to` = 'reportingsjr' ORDER BY id DESC You could also use a bit (to keep the size of your database down) where 0 = public and 1 = private (or vice-versa). Could even name the "type" column to "IsPrivate".OR, if there was never a situation where a message could be both public and private, you could rely on one column like in your example: SELECT * FROM `chat` WHERE `to` = 'everyone' ORDER BY id DESC SELECT * FROM `chat` WHERE `to` = 'reportingsjr' ORDER BY id DESC The only thing to worry about there is that nobody has a username of "everyone". :)To add another layer of abstraction to your table, you could use userIDs instead. If the chat is a private chat, then assign the userID column to the userID of the appropriate user. If it is a public one, then assign -1 to that column. Then, to get all the public messages, simply do a query for all items that have a userID of -1.
  22. I believe you can do a SHOW COLUMNS FROM mytable query in MySQL. Here's a link for more information:http://dev.mysql.com/doc/refman/5.0/en/show-columns.html $query = mysql_query("SHOW COLUMNS FROM `table`"); I haven't tested it though.
  23. I would suggest regular expressions.This regular expression would match the numbers in your filename:/[A-Za-z]+(\d+)\.jpg/I don't know how to do this in PHP, but in javascript, it'd look like this: var filename = "AlbumOne15.jpg";var number = filename.match(/[A-Za-z]+(\d+)\.jpg/)[1];alert(number); // alerts 15;
  24. Or maybe it's this one:http://w3schools.com/css/css_howto.asp
  25. Check out the HTML DOM. This page talks about many of the properties and methods that are available to you with the iframe object:http://www.w3schools.com/htmldom/dom_obj_iframe.aspvar frame1 = document.getElementById("iframe1");frame1.height = "400px"; // sets the iframe's height to 400pxframe1.width = "400px";frame1.src = "http://www.google.com/"; // set's the src of the frame to google's page
×
×
  • Create New...