14 Replies - 4473 Views - Last Post: 24 January 2012 - 04:52 AM

#1 Reprobus  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 75
  • Joined: 24-November 10

Email Form Script External Question

Posted 20 January 2012 - 07:36 PM

If I have some code between <script></script> tags that is visible in the source code. I can place that as a external script but how will the form know how to read the script ?
Is This A Good Question/Topic? 0
  • +

Replies To: Email Form Script External Question

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3524
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Email Form Script External Question

Posted 21 January 2012 - 01:15 AM

the form doesn’t, and it doesn’t need to. when the parser engine of the browser comes to the <script> tag (while loading the page) it reads its content. whether that is inline code or an external file doesn’t matter.
Was This Post Helpful? 2
  • +
  • -

#3 Reprobus  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 75
  • Joined: 24-November 10

Re: Email Form Script External Question

Posted 21 January 2012 - 08:09 PM

I copied the code out of the page, placed it into a external file. Placed the external file within script tags back into the page and it broke the page ?
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3524
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Email Form Script External Question

Posted 22 January 2012 - 03:08 AM

depends on what your script tag looks like and what you’ve written in the file.
Was This Post Helpful? 0
  • +
  • -

#5 Reprobus  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 75
  • Joined: 24-November 10

Re: Email Form Script External Question

Posted 22 January 2012 - 09:34 AM

What are the typical things that may make it break ? Bastard, I thought it would just work, arrrghhh.
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3524
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Email Form Script External Question

Posted 23 January 2012 - 04:01 AM

typical things:
- a JS syntax error
- invalid URI
- JS content in a script tag already referencing a JS source
- executing the JS script before the DOM/page is ready (i.e. you can't access elements not yet rendered)
- sometimes it matters if you use file:// or http://
Was This Post Helpful? 0
  • +
  • -

#7 Reprobus  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 75
  • Joined: 24-November 10

Re: Email Form Script External Question

Posted 23 January 2012 - 07:24 AM

Quote

- a JS syntax error
- invalid URI
- JS content in a script tag already referencing a JS source
- executing the JS script before the DOM/page is ready (i.e. you can't access elements not yet rendered)
- sometimes it matters if you use file:// or http://


Can I check if the JS code is being executed before the DOM page ? From my understanding there is no JS syntax errors. There are no HTML errors in the page, that rules out any script tags that shouldn't be there. Arrrghh !

This post has been edited by Reprobus: 23 January 2012 - 07:26 AM

Was This Post Helpful? 0
  • +
  • -

#8 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3524
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Email Form Script External Question

Posted 23 January 2012 - 07:38 AM

View PostReprobus, on 23 January 2012 - 03:24 PM, said:

Can I check if the JS code is being executed before the DOM page ?

JS scripts are executed when they are loaded, i.e. immediately.


View PostReprobus, on 23 January 2012 - 03:24 PM, said:

From my understanding there is no JS syntax errors.

did you check in the Error Console?


View PostReprobus, on 23 January 2012 - 03:24 PM, said:

There are no HTML errors in the page, that rules out any script tags that shouldn't be there.

did you verify that? (w3.validator.org)
Was This Post Helpful? 0
  • +
  • -

#9 Reprobus  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 75
  • Joined: 24-November 10

Re: Email Form Script External Question

Posted 23 January 2012 - 09:08 PM

Quote

did you check in the Error Console?

The only error is from a Google SEO and jQuery 1.4 but when the code was embedded into the page, these errors were not to be seen. I can't update jQuery because I have a script that won't work on newer version of jQuery.

Quote

did you verify that? (w3.validator.org)

Yes, there are no errors in the HTML. My guess is how it's being loaded, I have the script at the top of the page in the <head>, no in the <body>. How can I find what is causing me this headache.
Was This Post Helpful? 0
  • +
  • -

#10 JMRKER  Icon User is offline

  • D.I.C Addict

Reputation: 128
  • View blog
  • Posts: 826
  • Joined: 25-October 08

Re: Email Form Script External Question

Posted 23 January 2012 - 09:35 PM

So, when are you going to get around to showing the code you are using
or provide a link to a test site versions of what you are doing?
We can guess all day as to what you are doing wrong, but it would be faster to see!
Was This Post Helpful? 0
  • +
  • -

#11 Reprobus  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 75
  • Joined: 24-November 10

Re: Email Form Script External Question

Posted 23 January 2012 - 10:42 PM

here is the page, "contact e-mail" is the script that is breaking the page.
Was This Post Helpful? 0
  • +
  • -

#12 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3524
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Email Form Script External Question

Posted 23 January 2012 - 11:23 PM

there is a syntax error in contact_email.js.
Was This Post Helpful? 0
  • +
  • -

#13 Atli  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3718
  • View blog
  • Posts: 5,982
  • Joined: 08-June 10

Re: Email Form Script External Question

Posted 23 January 2012 - 11:40 PM

Hint: You can't put HTML elements directly into a Javascript file. Javascript files are Javascript only, not the language soup most HTML files are.
Was This Post Helpful? 0
  • +
  • -

#14 Reprobus  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 75
  • Joined: 24-November 10

Re: Email Form Script External Question

Posted 24 January 2012 - 03:45 AM

The JS and Syntax error wouldn't be this ?

Quote

</script>
<script type="text/javascript">

This post has been edited by Reprobus: 24 January 2012 - 03:46 AM

Was This Post Helpful? 0
  • +
  • -

#15 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3524
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Email Form Script External Question

Posted 24 January 2012 - 04:52 AM

yes, they would. as Atli explained.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1