Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascrtip/html

Status
Not open for further replies.

999000333

Programmer
Nov 20, 2006
39
Hello I have a function in my html webpage written in javascript called createListRegions, this function is inside the <head> tag. Now I call this function in my html page as follow:

<body class="site_homepage" style="background-color: #dddb10" onLoad=" createListRegions();">


my problem is when I use Mozilla firefox the functions is loaded in my html page properly, this is I see the list of the regions I have created. But when I use Microsoft Explorer the list CANNOT BE SEEN, nothing is loaded.

Can any one know how to solve this problem.

Thank you.
Paola
 
Not without seeing your code. Lots of psychos here, very few psychics.

Lee
 
you need only the javascript or also the html(quite big)? let me know and if you are kind enogh to look at it I will send them, thanks.
Paola
 
Are there any error messages in the Firefox Javascript console?

You should show the relevant Javascript code and any relevant HTML when you ask a question here.

Lee
 
First I don't have any error message in Firefox acutally everything there works fine. Here is the code in a separate file that takes all the regions and nations names from the datebase:
function listNations()
{
global $table_geog_nations;
$query = "SELECT id, nome FROM `$table_geog_nations`";
$result = mysql_query($query) or die(mysql_error());
return $result;
}

function listRegions()
{
global $table_geog_regions;
$query = "SELECT id, nome FROM `$table_geog_regions`";
$result = mysql_query($query) or die(mysql_error());
return $result;
}
So these functions are in a separate file.

here is the javascript inside my index.html code where the list should be displayed




<head>
<script language="javascript" type="text/javascript">
function searchPage(page)
{
document.cerca.pagina.value = page;
document.cerca.submit();
}

function createListNations()
{
nation = document.getElementById ("NazioneID");
<?php
$result = listNations();

while($res = mysql_fetch_array($result))
{
echo "nation.innerHTML = nation.innerHTML + \"<option value='" . $res['id'] . "'> " . $res['nome'] . " </option>\"; \n ";

}
?>
}


function createListRegions()
{
region = document.getElementById("RegioneID");
<?php
$result = listRegions();

while($res = mysql_fetch_array($result))
{
echo "region.innerHTML = region.innerHTML + \"<option value='" . $res['id'] . "'> " . $res['nome'] . " </option>\"; \n ";

}
?>
}
</script>

</head>
<body class="site_homepage" style="background-color: #dddb10" onLoad="createListNations(); createListRegions();">
...... ......... ....



I hope this can be of help.
Thanks Paola
 
This is the Javascript forum, not PHP. Please show only relevant client-side Javascript and HTML.

Lee
 
Could it be that there is a space here (after getElementById):

Code:
nation = document.getElementById ("NazioneID");

[small]"I see pretty girls everywhere I look, everywhere I look, everywhere I look. - Band song on movie "The Ringer"[/small]
<.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top