1,330 Posted Topics
Re: ZVN, As Pritaes said plus ...... Unfortunately, [ICODE].getElementsByClassName[/ICODE] is far from safe. Too many browsers don't support it. So you have to be a bit old fashioned and do it longhand with [ICODE].getElementsByTagName[/ICODE] then test for [ICODE].className[/ICODE] in the loop. Try this: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" … | |
Re: Dan, I'm sure it's not the whole answer but you could try: [CODE]function start_map(){ var levels = ['boss', 'monkey', 'secret', 'gifty']; levels.each(function(level){ if (!level_data[level].complete) $(level + "_map").observe('click', [COLOR="Red"]function(){put_content(level)}[/COLOR]); }); } [/CODE] Remember that when specifying a function as an event handler, it will (normally) be either be a function name … | |
Re: Kjelle, I understand most of what you ask but this paragraph is slightly confused: [CODE] But then the problem: if login IS ok - so that the users ID and real name is returned from the serverscript - I would like to store those variables in a session variable ($_SESSION … | |
Re: Proprasee, Something like this maybe: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <style type="text/css"> button { float:left; width:50px; height:50px; margin:2px; color:#FFF; } </style> <script> onload = function(){ var buttons = document.getElementsByTagName('button'); for(var i=0; i<buttons.length; i++){ if(buttons[i].className.indexOf('type1')>=0 || buttons[i].className.indexOf('type2')>=0){ buttons[i].style.backgroundColor = (buttons[i].className.indexOf('type1')>=0) ? '#0000c0' … | |
Re: I don't think it's the !Doctype. Could be your editor. MS Word with "smart quotes" turned on is a particular annoyance. Maybe other editors too. First thing to try is Notepad to inspect/edit/save a copy. [B]Airshow[/B] | |
Re: Checker, [QUOTE=checker;1059841]Can css assign images?[/QUOTE] Yes, by using a background image. Something like this for example: In your 1284 stylesheet: [CODE=css] .hover { width: 100px; height: 50px; background-image: url('images/photography_large.jpg'); background-repeat: no-repeat; background-color: #999; } [/CODE] [CODE=css] And in the 1024 stylesheet: .hover { width: 50px; height: 25px; background-image: url('images/photography_small.jpg'); background-repeat: … | |
Re: Abah, [QUOTE=abah05;1063036]is there any command or ajax that Javascript is checked repeatedly to one or two variables without any command and without reloading the page...??? [/QUOTE] Simple answer is yes, but only if I understand the question correctly. [QUOTE=abah05;1063036]This section is repeated or changes automatically [I]if the data is changed[/I][/QUOTE] … | |
Re: You need a mechanism for putting control.html to player.html back together. There are several approaches: [LIST=1] [*][B]Server-side script[/B] : Recompose the page server-side - eg. PHP or SeverSide Includes (SSI). [*][B]AJAX[/B] : Serve a page containing one component with JavaScript/ AJAX to fetch the other component and insert it dynamically … | |
Re: Petr, You will have more success by working with ids rather than classes. With classes, a statement like [ICODE]$(".price").......[/ICODE] will match ALL elements where [ICODE]class="price"[/ICODE]. With ids, a statement like [ICODE]$("#price_0").......[/ICODE] will match ONE element where [ICODE]id="price_0"[/ICODE]. On creating a new row, you should ensure that appropriate elements are given … | |
Re: LizzyJo, You can't have miltiple statements of the form [ICODE]onload = function(){};[/ICODE]. Each statement overwrites the previous one. To define functions (in the global namespace) use the form [ICODE]function fnName(){}[/ICODE]. Use the form [ICODE]onload = function(){};[/ICODE] to define code that must run after the page has loaded. Just one [ICODE]onload … | |
Re: Maybe I'm being dumb but I don't get it. That's a very ordinary piece of HTML that could have been written manually or generated by a script. Why does this qualify as a Code Snippet? How does the HTML relate to "save myself time having to manually put in the … | |
Re: Agent Cosmic, Personally I avoid [ICODE]setInterval[/ICODE] in favour of repeated [ICODE]setTimeout[/ICODE]s. Here is a version of your code framed in a namespace pattern: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Jquery Clock</title> <style type="text/css"> #clockWrapper { width: 150px; padding: 10px; border: 2px solid #000; … | |
Re: Shishtawitch, The code looks like it should work, however. two things ..... 1. At the line [ICODE]$id_2 = $g["id"];[/ICODE], surely $id_2 must be equal to $id because it comes from a row resulting from a query which returns rows where [ICODE]id=='$id'[/ICODE]. If I'm right, then the second query doesn't need … | |
Re: Gaz, If all your moving elements are contiguous within the DOM (or can be made so), then a much simpler approach is available - namely, create a div to wrap all the elements and style it with [ICODE]position:absolute;[/ICODE] or [ICODE]position:relative;[/ICODE] (and initial left/top). Now modify your [ICODE]moveimg()[/ICODE] function to move … | |
Re: Basilabraham, You should never ever nest HTML forms for the reason I explained [URL="http://www.daniweb.com/forums/post992670.html#post992670"]here[/URL]. A workaround, in your case, is to code your "option button" as a hyperlink of the form: [CODE=HTML] <a id="optionButton" href=""><img src="optionButtonImage.gif" border="0"></a> [/CODE] [I](You could also use a <button> element, but without its own <form>)[/I] … | |
Re: Whitestream6, Do you mean that you want to build an HTML table, storing chunks in a php array as you go? If so, then consider this pseudo code: [CODE=php_pseodocode] var htmlTable = array();//initialise array for(.......){//loop to create rows one at a time. htmlTable[] = make_new_row_here;//append new array element containing (string) … | |
Re: Davil, IE6 certainly does do AJAX. I think you would be better off avoiding setInterval(). Better to make your "upload" http request into an AJAX call, with a response handler that simply displays (or alerts) the response string. You will then need to arrange for a php page to handle … | |
Re: Carl, There's a number of things here .... First - how to get the selected option's value from a select menu: [CODE] //within function calculatePrice var menu = document.getElementById("state"); var state = (menu) ? menu[menu.selectedIndex].value : null; [/CODE] Note the safety in case the menu is not found (prevents javascript … | |
Re: Beattsme, You could inspect javascript's History object but whatever you wrote could be defeated. Reason being that (a) the page would always be served in its entirity (though not necessarily rendered) and (b) in most browsers, javascript can be turned off. In short, javascript executes too late to reliably suppress … | |
Re: Kimayarani, I'm not too familiar with Dreamweaver but think you need a custom script. Something like this maybe: [CODE=javascript] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <script> onload = function(){ var img = document.getElementById('myImg'); var rollovers = [ {src:'path/to/images/image_a.jpg', alt:'image_a.jpg'}, {src:'path/to/images/image_b.jpg', alt:'image_b.jpg'}, {src:'path/to/images/image_c.jpg', alt:'image_c.jpg'}, … | |
Re: Helban, Try this :- [CODE=javascript]function getWeekNo(startDay, baseDate){ var now = new Date(); startDay = (!startDay) ? 0 : startDay;//Default to Sunday baseDate = (!baseDate) ? new Date(now.getYear(), 0, 1) : baseDate;//Default to 1st Jan of current year. if(startDay !== -1){ while(baseDate.getDay() !== startDay){ baseDate.setTime(baseDate.getTime() - (24 * 3600 * 1000)); … | |
Re: What level? What's the course title? Do they provide written guidelines for projects? [B]Airshow[/B] | |
Re: XMLHttpRequest can behave either synchronously or asynchronously, as determined by the third parameter in the line of the form [ICODE]xmlhttp.open("GET", url, true);[/ICODE]. With synchronous behaviour, javascript execution is suspended (after sending the request) until the server responds. This is very similar to a regular function call in javascript, except that … | |
Re: Neogy, First thing to try is to combine the two code blocks above into a single [ICODE]$(document).ready(function(){.....});[/ICODE] structure. [B]Airshow[/B] | |
Re: LizzyJo, Consider this: [CODE=html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Aggregation</title> <style type="text/css"> body { font-family: verdana, arial, helvetica, sans-serif; font-size: 10pt; } form { margin: 0; } #outerwrapper { width: 240px; border: 2px solid #006699; } #outerwrapper h1 { margin: 0; padding: 3px … | |
Re: At the risk of stating the obvious ..... For one-off conversion(s), then do it manually. With Adobe Acrobat (version??) installed, you should be able to print to PDF - "Adobe PDF" appears under "Select Printer". Under Windows you may also have right-click "Append to existing PDF" and "Convert to Adobe … | |
Re: Can't see the effect so can't really debug it, however here's a handful of observations: [LIST] [*]Header table has attribute [ICODE]align="left"[/ICODE] which is equivalent to a float, therefore maincontent div need [ICODE]style="clear:left;"[/ICODE] (or [ICODE]clear:both;[/ICODE]) to force it (and subsequent markup) below the table. [*]Copyright statement looks like it should appear … | |
Re: Something like this maybe ... [CODE=html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <style type="text/css"> #f1 p { margin:0; } #styledTxt { width:300px; margin:12px 0; padding:10px; border:1px solid #999; line-height:20px; } </style> <script> var TEXTBOX = function(){//Namespace wrapper //Private members var fonts=[], el_1, el_2, … | |
Re: I have to say, that's absolutely nothing like javascript Nuttdude. Try this: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <style type="text/css"> .hidden { visibility: hidden; } </style> <script Language="JavaScript"> function formVisibles(){ document.Form1.B1.style.visibility = (document.Form1.BalPmtPayee.value == "") ? 'hidden' : 'visible';//-- reverse hidden|visible for … | |
Re: FireHaz, [U]Hint[/U]: Don't use document.write(). Use DHTML/DOM methods to read the user's input and to write the result to an HTML element, identified by an id. Try researching [ICODE]document.getElementById()[/ICODE]. [B]Airshow[/B] | |
Re: BreachJar, I think you want something like the code below. It certainly grows exponentially, trouble being that it grabs my processor (less than 1GHz) so effectively that the onscreen counter becomes sluggish from about 1500 and the "stop" button takes quite a while to respond. And that's with all the … | |
Re: OnIIcE, There are several ways to aproach this. My preferred methods are:- [LIST] [*]Disable the html element (input field or button) which stimulates the ajax action. This method is good (when available) in that it is (a) simple and (b) gives the user a useful indication that the action is … | |
Re: I only know about UK postcodes in any detail. Full validation is not simple and can only be undertaken by lookup, for which the Post Office will SELL you something called the [URL="http://en.wikipedia.org/wiki/Postcode_Address_File"]Postcode Address File[/URL] - with over 28 million entries!!! The PAF is updated regularly to keep up with … | |
Re: Dmmajorstudent, I'm afraid this addresses only part of your problem (help fields) but the javascript should make a good basis for doing form validation too. [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Form help fields</title> <style type="text/css"> fieldset { display:block; margin:0 0 10px 0; … | |
Re: lifeworks, I'm not certain but think you have to compose your [URL="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html"]mod_rewrite[/URL] rule such that it passes on the originally request url as a parameter in the querystring. [B]Original request[/B] [TEX]http://www.mydomain.example/mydoc.pdf[/TEX] [B]Redirect[/B] [TEX]http://www.mydomain.example/dochandler.php?doc=http://www.mydomain.example/mydoc.pdf[/TEX] Then, in dochandler.php, you can pick up the original request as [ICODE]$_GET['doc'][/ICODE]. All you have to do … | |
Re: Nomad, I would do it with <h1> and <h2> tags, thus making the two lines independent of each other. I think you will find that the :first-line approach will superimpose its 3.5em on the 1.8em already applied, effectively giving (1.8 * 3.5)em or 6.3em. [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML … | |
Re: Kadjii, For an introduction to Javascript you can do worse than read this: [url]http://javascript.crockford.com/survey.html[/url] and [URL="http://javascript.crockford.com/"]other articles[/URL] from the same author. [B]Airshow[/B] | |
Re: Rblalock, In my experience, the best approach for form calculations of this type is to have a single (or supervisor) function which performs all calcs throughout the whole form (spreadsheet-fashion), and to call this function from a variety of event handlers (including window.onload). The calc function would look something like … | |
Re: Kadjii, In a nutshell, you serve the page with <img> tags in all relevant table cells. Then, in response to whatever events, javascript changes the images by dynamically setting the <img>'s src. Advice abounds. Search the web for "DHTML image replacement" or "javascript image replacement". [B]Airshow[/B] | |
Re: Steven, Rather than go into a lot of detail here, why not type "AJAX tutorial" into Alta Vista or Google. Or search Daniweb. Plenty of advice already exists without the need to add to it here. I leaned all my AJAX from the web. [B]Airshow[/B] | |
Re: Mekmiotek, At line 71 try replacing [ICODE]fwLoad[image]=new image;[/ICODE] with [ICODE]fwLoad[image]=new Image();[/ICODE]. [B]Airshow[/B] | |
Re: Mosel, Nothing should prevent array.push() from working within an if clause, as long as array is in scope and whatever you are trying to push is valid. Scope is different in javascript from php. Undeclared variables in functions are GLOBAL. Declared variables are LOCAL. I guess that your problem is … | |
Re: Realchamp, Another way to do this is to use the "sprite" method. A sprite is a specially composed background image (in eg a div), which is dynamically offset (horizontally or vertically) by javascript to show one of two or more facets Sprites are efficient and fun and very well documented … | |
Re: Crazygolfer, Try this, [CODE=javascript] function checkRow(chBoxId){ var ch = document.getElementById(chBoxId); if(ch){ ch.checked = true; } } [/CODE] [CODE=HTML] <form ....> <table border> <tr> <td><input type="checkbox" name="r1"></td> <td onclick="checkRow('r1')">Row 1 Text 1</td> <td onclick="checkRow('r1')">Row 1 Text 2</td> <td onclick="checkRow('r1')">Row 1 Text 3</td> </tr><tr> <td><input type="checkbox" name="r2"></td> <td onclick="checkRow('r2')">Row 2 Text 1</td> … | |
Re: CSS overflow property. [B]Airshow[/B] | |
Re: As far as I can see, freemeto makes its images available only in certain sizes which you select from a menu. You can force the image to the size you want with :- [CODE]<img src="http://......." width="250" height="60">[/CODE] but this will distort the image if its aspect ratio is different from … | |
Re: Dat0, I think you will find that css [ICODE]position[/ICODE] is inhibited from being applied to table cells because it would at least potentially cause confict/ambiguity with regard to the layout of the rest of the table. After all, TDs are by definition block-like elements that are positioned relative to their … | |
Re: Here's a demo of the border effects theoretically available from CSS. [CODE=html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Border Styles Demo</title> <style type="text/css"> body { background-color: #e0e0e0; } input { margin: 6px 0; width: 200px; height: 30px; border-width: 2px; } </style> </head> <body> <input … |
The End.