Jump to content

Pollux

Members
  • Content Count

    102
  • Joined

  • Last visited

Everything posted by Pollux

  1. The first thing you should probably learn is that Java and Javascript are very different. Java is a fully fledged programming language comparable to C/C++, for developing standalone applications. That's definitely not what you want in this case. Javascript on the other hand, looks a little bit like Java on the face of it (hence the name), but is fundamentally completely different. Javascript is used predominately as a client-side web programming language, which is exactly what you're after. Next stop -> w3schools javascript tutorial . Good luck!
  2. On refresh the last selected option will be displayed. You cannot override this with HTML but you can with some javascript. You'll need to read the javascript tutorials to understand this properly but the basic idea will be to set an onload event on the body which will call a javascript function which you will define in the head to set the selected option to "none". If you need more help with this then post in the javascript forum.As jlhaslip says, you should really have a doctype too. It might make things easier in the long run. Have a read of this: w3Schools DOCTYPE.
  3. You're quite right, local variables are only local to the extent of the function they're in. I'm too much of a Java programmer
  4. If you are using xDoc on the other pages that are using loadXMLDoc() then it is indeed strange that they work since the xDoc variable is definitely not visible outside that function unless you've defined it outside. The other problem I've just seen is that you call process_cookie() which calls doIt() directly inside the head BEFORE you even call loadXMLDoc(). But even if you had called loadXMLDoc() before, since it is asynchronous you need to make sure it has returned before calling doIt(). So you should be calling doIt() either directly or indirectly from the onreadystatechange function.
  5. xDoc appears to be local to that if statement inside loadXMLDoc(), so when you're using it later inside doIt() it doesn't exist.
  6. xDoc = null; Try changing this to... var xDoc = null;
  7. Firstly, I'd say that you could probably achieve more and in a nicer way, if you were to add a server-side language such as PHP into the mix. But since you're just starting out we'll keep to HTML and Javascript for now. There's two parts to this problem - the slide-show of images on the second page, and then the setting of the initial image via the links on the first page. So to take them one at a time...1) Slide-show.You'll probably want to store information about your images in an array, and you'll need some sort of variable to store the current index in that array. Then you can write 2 func
  8. This isn't a trivial thing to do, but you would need to use Javascript, CSS and probably some Ajax. You could use a javascript/ajax toolkit to give you a head start, Dojo is my favourite. This will do the hard work for you but you'll still need fairly strong Javascript.
  9. Pollux

    Northwind Database

    I believe the NorthWind database is an example database that comes with MS Access. It don't know if it's available in SQL Server.
  10. Pollux

    Js Help!

    Just to correct a couple of minor mistakes...The toggle_display() function should be: function toggle_display (id) { el = document.getElementById(id); if (el.style.display != "none") { el.style.display = "none"; } else { el.style.display = "block"; }} Otherwise it won't toggle correctly. Also, when calling the toggle_display() function, the parameter should be a string. So the other snippet would be more like this: <span class="something" onclick="toggle_display('my_div')">(-/+)</span><div id="my_div"> Hidden Text</div>
  11. The problem is the line of CSS in your head: body {padding: 0px; margin: 150px 0px 0px 0px;} This adds a margin of 150px at the top of your body. The body is the visible bit of your page, which is why you need to put the image and center tags inside there not the head. The easy solution is just to remove this line completely, or alternatively you could change the "150px" to "0px". That will stop your logo being pushed down.
  12. I'd recommend sticking with using the .php file name extension for PHP files unless you have a good reason. The obvious reason for this is that if you're just learning PHP then it will help to keep things simple. The less obvious reason for this is that you then wouldn't be able to have .html files that don't require any PHP. You'll still be forcing these files to go through the PHP interpreter, adding an unnecessarily overhead.If you've got your mind set on using the .html extension for php files though...Go to the 'www' root (where your html docs are stored), look for a file called .htaccess
  13. Java and Javascript are different languages, it was Javascript the person answering in the HTML forum was referring to. However, the other answers in your original thread are more useful to you. Your DTD shouldn't be strict, it should be frameset. But, as already mentioned, if at all possible avoid the temptation to use frames all together.
  14. I don't really understand why you're arguing against this. You can use CSS for the same thing.That's not true. CSS can provide different styles, but XSLT will actually change the structure, reorder components and make decisions based upon the structure. It's impossible to achieve that with CSS. It's true that a well coded HTML site is better than a badly coded XHTML site, but that's not the point here. I'm sure you don't use any different approach because you probably follow good practice with HTML anyway. This point is most relevant for people learning (X)HTML. As with programming it's impo
  15. This sounds quite a lot like a homework project which many people are going to be reluctant to help you with. It's normally preferred if you attempt the problem and ask a slightly more specific question about what you get stuck on. Just to get you started, it sounds like you need a HTML form which takes the student ID, mark etc. The form needs to submit the values to your asp script. Read the ASP tutorial to find out how to retrieve the values from the form, perform the calculations you need and return a response.
  16. The immediate benefits of XHTML aren't obvious but they do exist. boen_robot's point is a good one about XML parsers and because it's XML you can use XSLT to easily create different presentations of the same page for different uses, perhaps for mobile devices. But even if you won't ever want to use any of the XML bits theres still the advantage that using XHTML encourages good practices and because it's stricter it makes tracking down problems easier. It also makes it easier for other people to read your code. They're subtle advantages maybe but it can actually make cross-browser compatibility
  17. There are a number of problems with your code.1) You've got nested <?php tags. You can scrap the outer set because all your php code is within the inner one.2) As Obi1 says, avoid starting a form component's name or id attribute with a number.3) Select tags don't have a type attribute, what you need to do is wrap all the form components in a form tag and then put a method="post" attribute in the form tag.4) Your form will also need a submit button which if you put in like this <input type="submit" name="submit" value="submit"> then that will help with the next point. Clicking the subm
  18. Yeah that should work fine, you just need to make sure that the function is visible when you're calling it. The contents of includes should be processed after they're included so any function calls should be able to call any functions visible to the main document. Once you've written the function you'll want to call the function something like this:<?php linkFunction("/dir/page.php", "Home") ?>Thats it, the real work is in the function where you have to decide whether "/dir/page.php" is the page you're currently on then output the correct thing.The differences between print and echo are
  19. valueOf() uses the getTime() implementation internally which means that as with getTime() it returns a timestamp which is ms since the epoch, however the unix timestamp is seconds since the epoch. So we need to divide by 1000 and then perform a round to get an integer.
  20. A slightly shorter way to achieve the same thing would be: Math.floor(new Date().getTime()/1000)
  21. To redirect, set the header like this in place of the echos. Just replacing "" with the addess you want to redirect to. header( 'Location: ' );
  22. Thats pretty good advice for usability. I assume you're talking about the links that make up a sites navigation and so are on every page. You could write a little function which you call for each navigation link, passing in the link location and the link text. The function would then need to check the current page's path obtainable with $_SERVER['PHP_SELF'] to the path received as a parameter. Depending on the result you either output an <a> or a <strong>.Thats the nicest way I can think of off hand. Hope that helps a little.
  23. Pollux

    parse error

    Looks like you started 2 threads for the same problem. Solutions in the other one...http://w3schools.invisionzone.com/index.php?showtopic=16368z
  24. Pollux

    parse error

    Theres 2 errors in the code you posted...1) Line 187: missing a single quote...$con = mysql_connect('jayam-designs.com','designj,'11111') or die('Could not connect: ' . mysql_error());2) Line 306: missing a bracket to close the block.if($row['ProdName'] == "Trolley"){ ?>Capacity: </div></td>That should fix the errors you're getting.
  25. Strangely that loads fine in FF but not in IE. I'm not totally sure what the problem is but try wrapping the ul in a div. <html><head><title>The Project</title><style type="text/css">ul.sciencelist{list-style-type: disc;}div.sciencelistdiv {position: absolute;left: 80px;top: 100px;}</style></head><body><h2>Time to study Science</h2><p><img src="ScientistsStudying.jpg" align="left"> Here is a list of items:-<div class="sciencelistdiv"><ul class="sciencelist"><li>Magnet</li><li>Spatula</li&g
×
×
  • Create New...