Graphix 68 ---

I tested your code with the following version:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>delay</title>
<script language="javascript">
function over(id) {
document.getElementById(id).style.backgroundColor = "#333333";
}

function out(id) {
document.getElementById(id).style.backgroundColor = "#cccccc";
}
</script>
</head>

<body>
<table width="950" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC" id="td1" onmouseover="over(this.id);" onmouseout="out(this.id);">
<span>Google</span>
</td>
<td bgcolor="#CCCCCC">&nbsp;</td>
<td bgcolor="#CCCCCC">&nbsp;</td>
<td bgcolor="#CCCCCC">&nbsp;</td>
<td bgcolor="#CCCCCC">&nbsp;</td>
<td bgcolor="#CCCCCC">&nbsp;</td>
<td bgcolor="#CCCCCC">&nbsp;</td>
<td bgcolor="#CCCCCC">&nbsp;</td>
</tr>
</table>
</body>
</html>

You should use it to check wether it works. This should work properly: when you hover the td, including the span, the td should remain the onmouseover color. If not:

Stop using old browsers and switch to (IE <- although your code works in this browser, dont use it) , FF, GC, Safari or Opera.

If you already have one of the above browsers: please update them to the latest version.

~G

Graphix 68 ---

When you Google before you start posting here, you are also able to find the answer:


http://www.google.com/search?q=changing+rightclick+menu+js

The top 3 of links that show at the top of the search:

http://yura.thinkweb2.com/scripting/contextMenu/
http://deluxe-menu.com/popup-mode-sample.html
http://www.milonic.com/menusample27.php

~G

Graphix 68 ---

Perhaps this is new to you, but people don't like downloading stuff when it is not necersary. Could you just simply post the code instead of making it a attachment? Makes it easier for all of us.

~G

Graphix 68 ---

>> I can't say this enough: PUT CODE IN CODE TAGS, THAT IS WHERE THEY ARE MADE FOR!

>> I tested out your code, and to prevent the delay, you need to remove the alerts.

>> Also, your problem is really vague, there is a td, which has a span element within it. When the td is hovered (including the span), the background colour changes. Explain clearly to us all what you want different?

~G

Graphix 68 ---
<div onblur="alert('You left the div!');" onfocus="alert('You focussed the div!');" style="width:300px; height:200px;"></div>

~G

Graphix 68 ---

Google a bit before you start asking questions?

The number 1 result is a website that holds all the information for captcha: http://www.captcha.net/

However, for some reason, you want to program your own:

http://www.codewalkers.com/c/a/Miscellaneous/Creating-a-CAPTCHA-with-PHP/

~G

Salem commented: Well said! +19
Graphix 68 ---

I assume somewhere in the javascript function that validates the form stands document.getElementById("someForm").submit() when/where the form has passed the validation.

The remedy to this solution is to let the function return a false or a true value, and use that within the onsubmit event (so remove the document.getElementById("someForm").submit() in the function):

The javascript:

function validForm() {
var valid = true;
if (document.getElementById("someTextField").value == "") {
valid = false;
}
// Here comes the rest of the validation
return valid;
}

The form:

<form action="formhandler.php" method="post" onsubmit="return validForm();">
...
... The form
...
</form>

~G

Graphix 68 ---

I think you misinterpeted me:

With auto-incremented numbers I mean:

CREATE TABLE ittraining (
.... The other columns
course INT(9) AUTO_INCREMENT NOT NULL,
PRIMARY KEY(course) )

And with strings I mean

CREATE TABLE ittraining (
.... The other columns
course CHAR(255) NOT NULL,
PRIMARY KEY(course) )

So when there is not an value set in the url:

mypage.php

A default value for $c is used, of which I don't know wether it should be a string or a number so I used 1 as value.

And when there is set a value in the url:

mypage.php?course=35

That value is used for the query.

~G

Graphix 68 ---

Perhaps the function doesn't know they are integers, use the following:

function updatesum() {

document.form1.totalfat.value = Math.floor(parseInt(document.form1.satfat.value) + parseInt(document.form1.monofat.value ) + parseInt(document.form1.polyfat.value));

}

~G

Graphix 68 ---

It should be on the top of the script. It just simply makes sure that there is a value for "c". The sql-query should be after it. Example:

<?php
$connection=mysql_connect('localhost',"a","aaa") or die(mysql_error());
$db='a';
mysql_select_db('a') or die (mysql_error());
//echo 'connection a successful';?>

if (isset($_GET['course'])) {
$c = addslashes(htmlentities($_GET['course']));
} else {
$c = 1;
}
$query="select * from ittraining where course like ' $c'";
$result=mysql_query($query) or die (mysql_error());
if($row = mysql_fetch_array($result))
{echo $row['course'] . " " ;
echo $row['content'] . " " ;
echo $row['clink'] . " " ;
echo $row['fees'] . " " ;
}
else
{
mysql_error();
mysql_free_result($result);
}
?>

Also, you need to change the $c into whatever you want as default, I don't know wether you use strings as the primary key of ittraining or auto-incremented numbers.

~G

Graphix 68 ---

Always use code tags:

<?php
$connection=mysql_connect('localhost',"a","aaa") or die(mysql_error());
$db='a';
mysql_select_db('a') or die (mysql_error());
//echo 'connection a successful';?>

<?php
$c=$_get['course'];
$query="select * from ittraining where course like ' $c'";
$result=mysql_query($query) or die (mysql_error());
if($row = mysql_fetch_array($result))
{echo $row['course'] . " " ;
echo $row['content'] . " " ;
echo $row['clink'] . " " ;
echo $row['fees'] . " " ;
}
else
{
mysql_error();
mysql_free_result($result);
}
?>

>> Line 7 - You added a extra <?php, which is not needed. This probably causes the error

>> Line 8 - It is better when you use $c = $_GET. Also, when retrieving variables from the url it is safer to first remove any harmful content: $c = addslashes(htmlentities($_GET['course'])); Also make sure there is a variable named course in the url, and if not, you use a default value:

if (isset($_GET['course'])) {
$c = addslashes(htmlentities($_GET['course']));
} else {
$c = 1;
}

~G

Graphix 68 ---

Math.floor rounds a number downwards to the nearest integer and returns that.

function updatesum() {

document.form1.totalfat.value = Math.floor((document.form1.satfat.value) + (document.form1.monofat.value ) + (document.form1.polyfat.value));

}

~G

Graphix 68 ---

You can use a interval to update the time every second. Also, every codeline needs to be closed with a ;

<html>
<head>
<script language="JavaScript" type="text/javascript">
function showDate() {
var date = getDate();
document.getElementById("time_date").innerHTML = date;
}

function getDate() {
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var hours = d.getHours();
var minutes = d.getMinutes();
var sec = d.getSeconds();

var suffix = "AM";
if (hours >= 12)
	{
		suffix = "PM";
		hours = hours - 12;
	}
if (minutes < 10) {
	minutes = "0" + minutes;
}
	
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear() + " " + hours + ":" + minutes + ":" + sec + suffix;
return TODAY;
}
window.onload = setInterval("showDate()",1000);
</script>
<title>My Page</title>
</head>
<body>
<div id="time_date"></div>
</body>
</html>
Graphix 68 ---

There has been atleast 5 image upload questions on this forum. There are tons of image upload scripts on the internet. If you can't retrieve and insert rows from a database using PHP, you should probably read a beginners book like PHP & MySQL for Dummies.

A few helpful links for image-uploading:

> http://www.daniweb.com/forums/thread214601.html
> http://www.webdeveloper.com/forum/showthread.php?t=101466

Don't say you searched the web when you have not even looked at the first page of Google search results for "php image upload"

~G

Graphix 68 ---

You can just simply echo the links? I don't understand what can possibly go wrong?

$blogs = get_last_updated();
echo 'Most active mommies:';
echo '<ul>';
foreach ($blogs AS $blog) {
    echo "<li><a href=\"".$blog['domain']."\">".$blog['domain']."</a></li>";
}
echo '</ul>';
Graphix 68 ---

>> Always put code within code tags:

<!DOcTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>first java script example</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
function calculateArea(Width,Height)
{
area=Width*Height
return (area);
}
</script>
</head>
<body>
<form name="frmArea" action="#">
enter the width and height:<br/>
width:<input type="text" name="txtWidth" size=5 /><br/>
height:<input type="text" name="txtHeight" size=5 /><br/>
<input type="button" value="calculate area" onclick="alert(calculateArea(document.frmArea.txtWidth.value,document.frmArea.txtHeight.value))"/>
</form>
</body>
</html>

>> To explain the code:

As you can see in the code part (highlighted red in the above code), there is a function that calculates the surface of a square. It requires 2 arguments: the width and the height of the square. The function's output is the width multiplied with the height.

Then there is a onclick event in the button-input (highlighted green), that calls a alert() function that shows the output of the calculateArea() function with the values entered within the form as the paramaters.

>> You forgot " at the opening tag of the form

~G

Graphix 68 ---

I finally found out what was causing all this: after the link is clicked, the browser executes the javascript and redirects the page to the packedR, but after that the browser redirects itself to the href in the <a> element. The solution: replace <a></a> with <span></span>:

This:

<a href="" id="RAC3" onClick="javascript:PrcsRow1a();">Morning Appt</a>

Needs to be:

<span id="RAC3" onclick="javascript:PrcsRow1a();" class="spanLink">Morning Appt</span>

You can beautify the text in the span using css:

<style type="text/css">
.spanLink {
color:blue;
text-decoration:none;
}
.spanLink:hover {
color:red;
text-decoration:underline;
}
</style>

~G

Graphix 68 ---

There doesn't seem to be any redirection in the HTML on page 3, so maybe there is either a problem with page 2 or with the asp code of page 3 (but this isn't the ASP.NET forum, so I won't be able to help if that is the case). Could you post the code of page 2?

~G

Graphix 68 ---

>> Line 2 and 7 - You already defined "diffy" as an array in line 2, you can not declare it again.

Use the following script:

<script type="text/javascript">
var numberArray = [696,039,231,909025,5325,326,983] ;
var differenceArray = new Array();
for (var s = 0; s < numberArray.length; s++)
{
differenceArray[s] = numberArray[s + 1] - numberArray[s];
}
document.write("The original numbers:<br /><br />");
for (var d = 0; d < numberArray.length; d++) 
{
if (d != numberArray.length - 1) {
document.write(numberArray[d] + ', ');
} else {
document.write(numberArray[d]);
}
}
document.write("<br /><br />The differences between the numbers:<br /><br />");
for (var a = 0; a < differenceArray.length; a++) 
{
if (a != differenceArray.length - 1) {
document.write("Difference between " + numberArray[a] + " and " + numberArray[a + 1] + " is " + differenceArray[a] + "<br />");
}
}
</script>

~G

Graphix 68 ---

Ok a small summary of your pages:

Page 1 - Retrieves value out of third party API
Page 2 - Receives the value from page 1 and displays a list of links
Page 3 - Receives which link is pressed and passes the data to a database of some sort

Your problem is that page 3 redirects back to page 2 when opened. Perhaps there is a redirecting javascript on page 3, changing the window.location.href after the page has been loaded? Or there is a meta-tag at the top of the page (example:

<meta http-equiv="refresh" 
content="10;URL=http://www.daniweb.com">

). Another possibility is that the asp code redirects the user to page 2 when finished?

Post some code that we can use :)

~G

Graphix 68 ---

>> You want the form to be checked before submitted:

Change the form tag into:

<form id="form1" name="form1" method="post" action="sendform.php" onsubmit='return isValid()'>

And the submit button into:

<input type="submit" name="button" id="button" value="Submit order" />

And the checkbox into:

<input type="checkbox" name="checkbox" id="checkbox"  value="agreed"/>

Then use the following javascript function:

function isValid() {
var checkbox = document.getElementById('checkbox').checked;
var mot = document.getElementById('Is Vehicle Roadworthy with Full M.O.T.').value;
if (mot == "Yes" && checkbox == true) {
	return true;
} else {
     if (mot != "Yes") {
	  alert("Your vehicle must be roadworthy with full M.O.T.");
	 }
	 if (checkbox != true) {
	  alert("You have to agree with the Terms and Conditions");
	 }
     return false;
}
}

>> You want to redirect the user after submitting

Place the following code at the end of sendform.php:

header('Location: http://www.n-v-m.co.uk/Thankyou.html');

~G

Graphix 68 ---

First of all: why would you use jquery for this simple request? Anyway... The variable xhr is not available in the second function, so it can't retrieve it's responseText. I don't have experience with jQuery AJAX, so I assume your syntax is written correctly (it seems like it is).

~G

Graphix 68 ---

I see you found a solution for it yourself. However the way you solved is a bit on a cumbersome manner. If you want a form to not be submitted, you just adjust the form tag:

<form action="" method="post" onsubmit="return false;">
...
... The form
...
</form>

This way, also when the user presses the enter-button on his keyboard, the form won't be submitted.

~G

Graphix 68 ---

The most common mistake ever made in this forum: AJAX is not a programming language, it is a set of javascript functions that allow you to send/retrieve data to pages when the page is already loaded. And, for the thing you want, no AJAX is needed: just regular javascript will do the trick.

The code:

<html>
<head>
<script type="text/javascript">
function calc_to(from_year) {
// Start year:
var start = parseInt(document.getElementById("min_year").value);
// End year:
var end = parseInt(document.getElementById("max_year").value);
// Total amount of years:
var year_amount = parseInt(end) - parseInt(start);
// Amount of years selected:
var auto_added = from_year - start;
var innerHTMLto_year = "";
innerHTMLto_year += '<option value="">Select a year</option>';
var maximum_future_years = 20;
for (i = 0; i < maximum_future_years; i++) {
var year = auto_added + i + 1 + start;
innerHTMLto_year += "<option value='" + year + "'>" + year + "</option>";
}
document.getElementById("to_year").innerHTML = innerHTMLto_year;
}
</script>
</head>
<body>
<form>
From <select name="from_year" id="from_year" onchange="calc_to(this.value)">
<option value="" selected="selected">Select a year</option>
<option value="2000" id="min_year">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005" id="max_year">2005</option>
</select> to 
<select name="to_year" id="to_year">
<option value="" selected="selected">Select a year</option>
</select>
</form>
</body>
</html>

~G

Graphix 68 ---

I am such an idiot, I changed the || into &&, this must work, else I give up. Create these two files in the same folder, and see wether it works:

ajtest.html

<html>
<head>
<script type="text/javascript">
function init(){
 myRequst = new XMLHttpRequest();                          
 var url = "number.txt";
 myRequst.open("get",url);  
 myRequst.send(null);
 myRequst.onreadystatechange=function(){
 // If everything is OK:
 if ( (myRequst.readyState == 4) || (myRequst.status == 200) ) {
   // Returns the value in a alert box
   var data = myRequst.responseText;
   alert(data);
 }
 }
}
window.onload=init();
</script>
</head>
<body>
</body>
</html>

And number.txt:

1

~G

Graphix 68 ---

A long length password contains a few characters. The bigger the amount of characters, the more time it takes for a brute force hacker to gain acces to your website.

Definition of brute force hacking: trying out all the different combinations that are possible.

When a password is long and contains alot of different characters, it's very hard to hack it using brute force. This is why some sites say you need to have a password of atleast 8 characters or so.

~G

Graphix 68 ---

If the page is loaded, all the javascript scripts have been read and executed. You can only call the functions that have been read. When you use AJAX to change a innerHTML into whatever you want, the javascript of the innerHTML is not executed. So no, you can't.

By the way, it is also not necersary: you can just simply create a javascript-script that contains all the functions, and put that into the head section of the original page.

~G

Graphix 68 ---

You can just make 1 general function that needs a parameter named "page". I made the following code snippet for you:

window.onload = initAll;
var xhr = false;

function initAll() {
   if(window.XMLHttpRequest) {
         xhr = new XMLHttpRequest();
   }
   else {
      if(window.ActiveXObject) {
         try {
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch(e) { }
      }
   }
}

function showPage(page) {
   if(xhr) {
   
      // Opening the url
	  
	  var url = "";
	  
	  switch (page) {
	  case "home" :
	  url = "pageHome.txt";
      break;
	  
	  case "contact" :
	  url = "pageContact.txt";
	  break;
	  
	  case "portfolio" :
	  url = "pagePortfolio.txt";
	  break;
	  
	  default:
	  url = "pageHome.txt";
	  break;
	  }
	  xhr.open("GET",url, true);
      xhr.send(null);
	  
       xhr.onreadystatechange=function(){
        // If everything is OK:
        if ( (myRequst.readyState == 4) && (myRequst.status == 200) ) {
		 // Showing the results int he updateArea
		 document.getElementById("updateArea").innerHTML = xhr.responseText;
        }
	   }
    } else {
	 document.getElementById("updateArea").innerHTML = "Sorry but the XHR could not be created.";
	}
}

~G

Graphix 68 ---

Sorry i forgot to add a accolade:

function init(){
 myRequst = new XMLHttpRequest();                          
 var url = "http://localhost/dummy.php";
 myRequst.open("get",url);  
 myRequst.send(null);
 myRequst.onreadystatechange=function(){
 // If everything is OK:
 if ( (myRequst.readyState == 4) && (myRequst.status == 200) ) {
   // Returns the value in a alert box
   var data = myRequst.responseText;
   alert(data);
 }
 }
}
window.onload=init();
Graphix 68 ---

Your AJAX request has not yet been processed yet, use the following:

function init(){
 myRequst = new XMLHttpRequest();                          
 var url = "http://localhost/dummy.php";
 myRequst.open("get",url);   
 myRequst.send(null);
 ajax.onreadystatechange=function(){
 // If everything is OK:
 if ( (myRequst.readyState == 4) && (myRequst.status == 200) ) {
   // Returns the value in a alert box
   var data = myRequst.responseText;
   alert(data);
 }
}
window.onload = init();

~G

Graphix 68 ---

I also looked through the results of "Genie Scroller" with Google, and also found out there are no other scripts that works like the one Adobe made. Perhaps you should contact Adobe via E-mail, asking wether you could still purchase their product, although it has been discontinued? I also saw you could click the green button "Buy now for €59", perhaps that still works?

~G

Graphix 68 ---

First of all: seats are usually displayed as squares. It so happens to be that table cells are also squars. Thats why it's so easy to use a table to show seats.

If you want a more realistic map of a bus, you will first need to make a ground plan of the seats, in which the seat-numbers are put. Then you are able to just simply create a select input into your form which has the seat numbers that are available as options, and put the image of the seats below the input.

A small example:

<table>
<tr>
<td>
Please select a seat, the seat numbers are shown in the groundplan below:<br />
<select name="seat">
<option value="1A">1A</option>
<option value="1B">1B</option>
<option value="1C">1C</option>
</select><br />
 (the seats that are already taken will not be shown in the dropdown list)
</td>
<td>
<img src="bus_groundplan.jpg" alt="Groundplan" border="0" />
</td>
</tr>
</table>

! G

Graphix 68 ---

I think you should use flash for this. I don't have a clue how to make 3d models in javascript (if it is even possible). However, a slideshow of images is possible. Visit the following link for an example: http://www.daniweb.com/forums/thread251289.html

~G

Graphix 68 ---

I would first advice that you write the HTML code (or generate it in php). Then, when the page is shown properly, you start writing the AJAX-based functions one by one. This is to prevent that your code doesn't work and that you have no idea where it all went wrong.

I learned AJAX and alot of PHP from the book PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)

A few links to online AJAX tutorials:

w3schools
Tizag

You can also Google yourself.

~G

Graphix 68 ---

Alright then, a new version of your riddle script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Rabit riddle</title>
<script type="text/javascript">
var puzzle = "rabbit";
var input;
alert("A riddle will follow shortly, if you want to stop, please enter 'stop' into the textfield.");
input=window.prompt('White and fast with four legs? Quess the answer!',' ');
var i = 1;
while (input != puzzle && input != "stop") {
switch (i) {
case 1 :
input=window.prompt("Try again?", "");
break;
case 2 :
input=window.prompt("Hint: it also has a tail?", "");
break;
case 3 :
input=window.prompt("Hint: it is smaller than a tree?", "");
break;
case 4 :
input=window.prompt("Hint: it is a animal?", "");
break;
case 5 :
input=window.prompt("Hint: it has big ears?", "");
break;
case 6 :
input=window.prompt("Hint: there are alot of them in Scotland?", "");
break;
case 7 :
input=window.prompt("Hint: it lives in a hole?", "");
break;
case 8 :
input=window.prompt("Hint: it eats vegetables?", "");
break;
case 9 :
input=window.prompt("Hint: alot of people think it only eats carrots?", "");
break;
case 10 :
input=window.prompt("Are you even paying attention?", "");
break;
case 11 :
input = "stop";
alert("It was a rabbit, how couldn't you have know it!");
break;
}
i++;
}
if (input == "rabbit") {
alert("Good job, you have guessed the right answer: 'rabbit'");
}
</script>
</head>
<body>
</body>
</html>

It works perfect in my browser, so if it doesn't in yours: please update your browser.

~G

Graphix 68 ---

I tested out your code and it came to the conclusion that it can't work. Due to the fact that the browser has already read the javascript and sees the innerHTML as normal html and not a script that needs to be executed. Also the <script language="JavaScript"></script> interruptes the javascript. I tested it with the following version:

<html>
<head><title>JavaScript test</title>

<script type="text/javascript">
<!--
function changeit(iVar)
{
	var newinnerHTML = "";
	if (iVar == 1)
	{

	newinnerHTML = '<script type="text/javascript">alert("test");</script>';		
							
	}
	else
	{
	newinnerHTML = "<a id='imagelink' name='imagelink' class='imagelink' target='_blank' href='home.html'>Home</a>";	
	}
	document.getElementById('div1').innerHTML = newinnerHTML;
	alert(document.getElementById('div1').innerHTML);
}
//-->
</script>

</head>
<body>
<div id="div1">
<script type="text/javascript">alert("test");</script>
</div>
<form action="">
<input type="button" onClick="changeit(1);" value="change javascript" />
</form>
</body>
</html>

And it doesn't work. However, when you want to display an image, it does work.

~G

Graphix 68 ---

If you want us to help, please post the code of singlegalery.js.

~G

Graphix 68 ---

>> line 26 and 29 - You only need one opening tag for a body.

~G

Graphix 68 ---

Could you post how the form is displayed within the source code, due to the fact that it would be easier to test the javascript code for ourselves.

~G

Graphix 68 ---

General:

>> Line 2 and 29 Dont use caps for elements or attributes, use lower case: <script type="text/javascript"></script> >> 28/29 There is a mismatch, the script tag needs to be closed before you close the html tag. This is wrong: <b><i></b></i>, this is correct: <b><i></i></b>

>> A script needs to stand within the head or body elements

About the script:

>> Line 3 - You can not assign a string to a variable like that, use: var puzzle = "rabbit"; >> If you run that while-loop, it will display all messages when the user entered a wrong answer at line 6

>> Line 6, 10, 13, 16, 19, 22 - You left a white space in the second argument, this can be annoying for the user when he only clicks on the box instead of selecting the entire line.

This is how you should write the while-loop:

var puzzle = "rabbit";
var input;
input=window.prompt('White and fast with four legs? Quess the answer!',' ');
var i = 1;
while (puzzle != input && input != "stop") {
alert("That answer was wrong. You have already made " + i + " mistakes, if you want to stop, please enter 'stop' into the answerbox. Perhaps you want to try again?");
input=window.prompt('White and fast with four legs? Quess the answer!',' ');
i++;
}

~G

Graphix 68 ---

>> Line 4 and 6 - you declare the variable's name as confirm , but you use the the variable name confir in the script.

>> Line 21 - === needs to be == ~G

Graphix 68 ---

My code is a function written in javascript that changes the height of an element in the document. If you would like the div to automatically become bigger when text is added within, you should use shawnCplus's solution. Here is the CSS you need (it includes browserhack):

<style type="text/css">
.divClass1 {
  min-height:400px;
  height:auto !important;
  height:400px;
}
</style>

And then you should change the following in your HTML where the div is located in which you put the text. You change that div into:

<div class="divClass1"></div>

This will result in that when the text's height is larger than 400px, the div will automatically become larger in height.

~G

Graphix 68 ---

You can do the following:

<script type="text/javascript">
function setHeight(id, newHeight) {
document.getElementById(id).style.height = newHeight;
return true;
}
</script>

~G

Graphix 68 ---

You can just use a function that calls different functions, example:

<script type="text/javascript">
function sayHi() {
alert("Hi");
}
function sayHello() {
alert("Hello");
}
function callHelloHi() {
sayHi();
sayHello();
}
window.onload = callHelloHi();
</script>

~G

Graphix 68 ---

I tried out the program you wrote yourself, and it returns the uneven numbers, what is there to solve?

If you would like the program to be re-useable without refreshing, calculates the even and uneven numbers and their sums you could try the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Even, uneven and sum of those numbers</title>
</head>
<body>
<script type="text/javascript">
function Numb() {

// Resetting numbers

document.getElementById("even").innerHTML = "";
document.getElementById("uneven").innerHTML = "";

// Retrieving the number

var number = parseInt(document.getElementById("number").value);

// Setting the sums of the even and uneven numbers 0

var unevensum = 0;
var evensum = 0;

// Loop lasts untill the number has reached 0

while ( number > 0){

// If the number is uneven:

if (number%2 == 1) {

// Updating the uneven number list

document.getElementById("uneven").innerHTML += number + ' ';

// Updating the unevensum with the number

unevensum = unevensum + number;

// Decreasing the number

number-- ;

// If the number is even

} else {

// Updating the even numbers list

document.getElementById("even").innerHTML += number + ' ';

// Updating the evensum with the number

evensum = evensum + number;

// Decreasing the number

number-- ;

}
}

// Updating the evensum and unevensum in the document (so their values are visible)

document.getElementById("evensum").innerHTML = evensum;
document.getElementById("unevensum").innerHTML = unevensum;

}
</script>
<form action="#" method="post">
<h3>Even, uneven and sum of those numbers</h3>
Please enter a number here: <input type="text" maxlength="5" id="number" …
Graphix 68 ---

You should first create a function that validates the input values, it returns true when they are all filled in and false when not. If you would also like to check wether they are according to a certain pattern (for example email xxx@xxx.xx), you could extend the function I wrote below with regExp() and such.

function checkInputs() {
var fname = document.getElementById("fname").value;
var lname = document.getElementById("lname").value;
var email = document.getElementById("email").value;
var usrname = document.getElementById("usrname").value;
var passwd = document.getElementById("passwd").value;
if (email != "" && lname != "" && email != "" && usrname != "" && passwd != "") {
return true;
} else {
alert("Not all the fields has been filled in!");
return false;
}
}

A few small adjustments to your form to make the function work:

<form action="/loginsys/login.php" method="post" onsubmit="return checkInputs();">
            <p></p>
            <table cellpadding="5px" id="form">
                    <tr>
                            <td>First Name:</td>
                            <td><input type="text" name="fname" id="fname" /></td>
                    </tr>
                    <tr>
                            <td>Last Name:</td>
                            <td><input type="text" name="lname" id="lname" /></td>
                    </tr>
                    <tr>
                            <td>Email:</td>
                            <td><input type="text" name="email" id="email" /></td>
                    </tr>
                    <tr>
                            <td>Username:</td>
                            <td><input type="text" name="usrname" id="usrname" /></td>
                    </tr>
                    <tr>
                            <td>Password:</td>
                            <td><input type="password" name="passwd" id="passwd"/></td>
                    </tr><tr>
                            <td></td>
                            <td><center><input type="submit" value="Login" /></center></td>
                    </tr>
            </table>
        </form>

~G

EDIT: Sorry, read past the jQuery part. Although my code probably works, ShawnCplus's matches your requirements of only jQuery :)

Graphix 68 ---

It really requires little work:

<script type="text/javascript">
function show(Id) {
document.getElementById(Id).style.display="inline";
}
</script>
<span onmouseover="show('myImage')">Hover here to see the image!!!</span>
<img src="someImage.jpg" id="myImage" border="0" style="display:none;" />

~G

Graphix 68 ---

I currently use Javascript and XHTML for clientside and PHP for serverside. (AJAX is something in between).

PHP and Javascript are easy languages in comparison to VSC++, C++, C and Java. The biggest difference is the you don't have to declare what type (int, char etc...) variables are. So I'd say, go for PHP, JS, XHMTL and AJAX.

Ofcourse there are other options, instead of PHP you could try ASP.NET

You should check out the languages and see what you like, tutorials on all of the web languages can be found at http://www.w3schools.com

~G

ps: Don't use too many 2's instead of "to", it's kind of confusing?

Graphix 68 ---

A few modifications should be made to your code:

>> Each codeline needs to be ended with a ; >> Line 15 - You forgot to add the script-type, it needs to be <script type="text/javascript"> >> Line 20 - Each time the function gets called, the step gets set to 2. It needs to be outside the function, else the increment in line 26 is useless and the image won't slide


>> Line 24 - It is not possible to adress a variable using a string, use the code I have written on the bottom of the post

>> Line 25 till 27 - Although it is shorter, keep using the accoladdes {} to start and end a statement.

My version of your function slideit():

var step=1;
function slideit(){
//if browser does not support, don't bother switching the image
if (document.images) {
switch (step) {
case 1 :
document.images.slide.src = image1.src;
break;

case 2 :
document.images.slide.src = image2.src;
break;

case 3 :
document.images.slide.src = image3.src;
break;
}
if (step<3) {
step++;
} else {
step = 1;
}
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",2500)
}
}

~G

Graphix 68 ---

Well, first of all there is no AJAX nor PHP required to do this. Its all DHTML and JavaScript. If you are not able to write your own functions, you could consider using jQuery. Click the link below to go to a tutorial page on Show and Hide of a element.

http://www.learningjquery.com/2006/09/slicker-show-and-hide

Although you now have the functions to show and hide elements, you also want to have that only 2 elements of 3 appear at a time. Unfortunatly, that is way to specific to be able to find a already written script on the internet that matches your specific requirements. I think you need to create a function for that on your own ;)

~G