Jump to content

Javascript/Ajax issue


adam84

Recommended Posts

My index page loads both of my JS scripts(ajax.js,functions.js). In that page,I have a table with 3 frame, left,center and right. The center frame's td tag hold a <DIV> tag. The are a list links in the right frame. When the user clicks a link (right frame), ajax loads the page in the center <DIV> tag. In the page that was loaded by the ajax, i have a button and when the button is clicked it called a javascript function located in my JS script file. For some reason, it doesnt seem to link to the JS script files. It always says 'object expected', when I click the button.

 

Once I include my JS file into the main page that is always loaded(index page), wiil I have to include the JS file in any of the page that ajax calls? Or since I already included the JS file already, do I have to include it into the page that the ajax loaded?

 

index page

<?
echo "<HTML>\n";
	echo "<HEAD>\n";
		echo "<TITLE>The Angry Dragon</TITLE>\n";
		echo "<script src=\"jsFunctions.js\" language=\"javascript\" type=\"text/javascript\"></script>\n";
		echo "<script src=\"ajax.js\" language=\"javascript\" type=\"text/javascript\"></script>\n";
	echo "</HEAD>\n";

	echo "<BODY BGCOLOR=\"#FFFFFF\" onLoad=javascript:mainOnLoad();>\n";
		echo "<CENTER>\n";
			echo "<FONT COLOR=\"#000000\"><H1></H1></FONT>\n";
				echo "<TABLE WIDTH=85% BORDER=1>\n";
					echo "<TR>\n";
						echo "<TD WIDTH=20% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=leftFrame ID=leftFrame></DIV><TD></TR></TABLE></TD>\n";
						echo "<TD WIDTH=60% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=centerFrame ID=centerFrame></DIV><TD></TR></TABLE></TD>\n";
						echo "<TD WIDTH=20% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=rightFrame ID=rightFrame></DIV><TD></TR></TABLE></TD>\n";
					echo "</TR>\n";
				echo "</TABLE>\n";
		echo "<CENTER>\n";
	echo "</BODY>\n";
echo "</HTML>\n";
?>

 

Part of the page that gets loaded

echo "<TR>";
echo "<TD VALIGN=MIDDLE ALIGN=CENTER COLSPAN=2>";
echo "<INPUT TYPE=BUTTON NAME=SEARCH ID=SEARCH VALUE='Search' ONCLICK=javascript:archivedSearch();>";
echo "</TD>";
echo "</TR>";

 

Any ideas? On what I can do?

Link to comment
Share on other sites

I'm not a huge AJAX guy I just started learning. One thing I know from PHP though, I don't even see a need for you to be using php to show any of that. Why not just use html?

<HTML>
<HEAD>
<TITLE>The Angry Dragon</TITLE>
<script src="jsFunctions.js" language="javascript" type="text/javascript"></script>
<script src="ajax.js" language="javascript" type="text/javascript"></script>
</HEAD>

<BODY BGCOLOR="#FFFFFF" onLoad="javascript:mainOnLoad();">
<CENTER>
<FONT COLOR="#000000"><H1></H1></FONT>
<TABLE WIDTH=85% BORDER=1>
  <TR>
<TD WIDTH=20% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=leftFrame ID=leftFrame></DIV><TD></TR></TABLE></TD>
<TD WIDTH=60% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=centerFrame ID=centerFrame></DIV><TD></TR></TABLE></TD>
<TD WIDTH=20% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=rightFrame ID=rightFrame></DIV><TD></TR></TABLE></TD>
  </TR>
</TABLE>
<CENTER>
</BODY>
</HTML>

Add to that all of the table and td declarations should be in ""

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.