Jump to content


  • Posts

  • Joined

  • Last visited

Previous Fields

  • Languages
    XHTML, CSS, JavaScript, PHP, SQL, Java

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location

Pollux's Achievements


Member (2/7)



  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 functions - one to perform the operation 'next' (which will show the next image along in the array from the index) and one for back (the index minus 1). You can get a reference to the image and change it's src attribute something like this... document.getElementById("elements_id").src="newImg.jpg" where elements_id matches the value of the id attribute on the <img> tag. I've included some code at the bottom for you to modify.2) Setting the initial image from links.This wouldn't normally be done using javascript. One option would be to add a querystring parameter onto the end of each link. Something like: <a href="page2.html?img=0">Img 1</a><a href="page2.html?img=1">Img 2</a><a href="page2.html?img=2">Img 3</a> Then when the page first loads (so probably called from the <body> tag's onload) you can try and extract the querystring's img parameter and then set the slideshow to display that index. But you can worry about that once you've got the basic slideshow working.And here's some code to get you started on the slideshow...Javascript to go in the head: <script type="text/javascript"> // An array of src attributes for our image slide-show. var imgArr = new Array(); imgArr[0] = "img1.jpg"; imgArr[1] = "img2.jpg"; imgArr[2] = "img3.jpg"; // Keep track of the current image being displayed. var index = 0; // Increments index and the sets the image to show that index. function next() { if (index < imgArr.length) { index++; setImg(index); } } // Decrements index and the sets the image to show that index. function back() { if (index > 0) { index--; setImg(index); } } // Sets the src attribute on the element with an id of "img_viewer". function setImg(i) { document.getElementById("img_viewer").src = imgArr[i]; }</script> HTML to go in the body: <img id="img_viewer" src="img1.jpg" /><a href="" onClick="java script:back(); return false;">back</a><a href="" onClick="java script:next(); return false;">next</a>
  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. If it's there then edit it, otherwise create it. Insert these lines: RemoveHandler .html .htmAddType application/x-httpd-php .php .htm .html Bare in mind this is an apache feature and doesn't work on all web servers.
  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 important to learn good practices, because you'll quickly get found out by bad practices when used on a large scale. XHTML encourages this, that's a good thing.It's easier to read someone elses XHTML because it's always going to be more similar to your own. This is simply because XHTML doesn't allow you so much freedom of coding style.The purpose for which HTML was originally developed is very different to how it's used now, so new features were tacked on. HTML would not exist how it does if it was known how it would come to be used. This is from the XHTML 1.0 W3C specification... ...enter XHTML. XHTML just gives a basis to move forward on. The ultimate point with XHTML is that it's no more difficult to write than HTML and you get full XML support thrown in. I probably wouldn't bother rewriting existing sites, but theres no reason not to use it for new sites.
  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.
  • Create New...