Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 07-13-2007, 07:57 PM Viewing JS Source?
MZA
Experienced Talker

Posts: 47
Trades: 0
I am completely new to javascript and I am viewing the source to a webpage that I would like to learn how it works, but it does not reference a .js file. It has the <script> tags but how does it define the functions?
MZA is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-13-2007, 08:06 PM Re: Viewing JS Source?
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
All script tags in a html page share the same data. One script tag can contain functions written to a pagee our referenced from an external js file while another script tag is calling the function to perform.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-13-2007, 08:24 PM Re: Viewing JS Source?
MZA
Experienced Talker

Posts: 47
Trades: 0
but there arent any other scripts or any javascript here is the entire source:

Code:
<html>
<head>
<title>Title</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<table width='100%' height='100%'><tr><td align='center' valign='top'>
<script>
function CheckForm() {
  url = document.getElementById('url');
  if (url) {
      if (url.value.substr(0,21) != "http://website.com") {
          alert("Please enter valid URL");
          return false;
      }
  }
}
</script>
<form action="http://website.com/index.php" method="post" onsubmit="return CheckForm()">
<input type="text" id="url" style="text-align:center" name="url" value="Enter  URL here" size="60" onfocus="if(this.value=='Enter URL here'){this.value=''}" >
<br><input type="submit" value="Submit" ></form>
</td></tr></table>
</body>
</html>
MZA is offline
Reply With Quote
View Public Profile
 
Old 07-13-2007, 09:29 PM Re: Viewing JS Source?
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
The function is defined in between the script tags, and the function is executed (or called) in the onsubmit attribute inside the form tag.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-14-2007, 01:43 AM Re: Viewing JS Source?
MZA
Experienced Talker

Posts: 47
Trades: 0
ok, so the javascript is only used for validating the contents of the form?

how do i view the source of what happens after you hit submit

the form action "index.php" is the same page
MZA is offline
Reply With Quote
View Public Profile
 
Old 07-14-2007, 02:07 AM Re: Viewing JS Source?
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
You can't view the php code since it lives on the server. It would be a security concern if we could view each others server side code.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to Viewing JS Source?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26200 seconds with 12 queries