aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes script not stops Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "script not stops " Watch "script not stops " New topic
Author

script not stops

deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
<HTML>
<HEAD>
<SCRIPT type="text/javascript">
function anchor_test() {
document.write("FGDF");
}
</SCRIPT>
</HEAD>
<BODY>
<A href="javascript:anchor_test()">Test</a>

</BODY>
</HTML>


in this script remains continous
i am not understand what is the problem?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.

I don't understand either, because the HTML/JavaScript you posted here not only isn't continuous, absolutely nothing will happen, because you don't call the function. Can't you see your post after you make it and notice it didn't work?!
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
now tell me the mistake in this code
you can run this code at your pc to find out problem
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I meant to put the code tags around the actual code, not just at a random location in your message.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What makes you think it's running infinitely?
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
i will remember this
but now please tell me what is the problem in this code while running scripts can't stops
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
can you check in this code by run it
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

amrita singhal wrote:can you check in this code by run it

I did. What makes you think it's running infinitely?
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
this is running at your pc?
but in my one whenever i clicked on test it shows the "fgdf"
but loading is continuous.
i don't undersdtand why?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Because different browsers deal with inappropriate JavaScript in different ways--just because the browser (FF will show a loading spinner, Chrome does nothing) is showing you something doesn't necessarily mean any of your code is executing infinitely.
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
can i stop this loading spinner
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Using document.write after the file is loaded will (generally) have undefined behavior. So probably not.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: script not stops