Jump to content


Photo

**solved** Why wont my .js file work?


  • Please log in to reply
3 replies to this topic

#1 laide234

laide234
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 24 August 2006 - 09:40 PM

I am calling a function in a .js file from a php file.

I am pretty sure I am calling my .js file correctly, using

<sc**pt language="JavaScript" type="text/javascript" src="../library/job.js"></sc**pt>

and

<input name="btnAddJob" type="button" id="btnAddJob" value="List Job" onClick="listJob();" class="box">

However, within my .js file, this function works:
function listJob()
{
window.location.href = 'index.php?view=add';
}

But when I modify it to a simple submit, it doesnt work.

function listJob()
{
submit();
}

The above code will not respond (I am trying to submit the contents of a form.. I intend on adding some validation before submitting).

Again, I am calling the file correctly... It just stops working when I change "window.location.href = 'index.php?view=add';" to "submit();"

I would like to know why this is happening.

#2 Corona4456

Corona4456
  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts
  • LocationEl Paso, TX

Posted 24 August 2006 - 09:57 PM

Isn't the syntax supposed to be:

document.myform.submit()
?
What is the CoronaMatrix?

#3 laide234

laide234
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 24 August 2006 - 11:02 PM

Thanks Corona4456. That worked.

#4 Corona4456

Corona4456
  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts
  • LocationEl Paso, TX

Posted 25 August 2006 - 05:29 AM

No problem... glad to help :).
What is the CoronaMatrix?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users