Web Design and Development Forums

how can i use my javascript code with my asp.net page

This is a discussion on "how can i use my javascript code with my asp.net page" within the ASP.NET Forum section. This forum, and the thread "how can i use my javascript code with my asp.net page are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > ASP.NET Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Jan 26th, 2008, 20:47   #1 (permalink)
Junior Member
 
Join Date: Dec 2007
Location: UK
Posts: 25
how can i use my javascript code with my asp.net page

hi,

i have written the following javascript code. however i am writing my web application using visual web developer 2008 express edition, and i am finding it hard to incorporate it into my asp.net page. can i use javascript in asp.net page? does anybody have any suggestions as to how i can do this. the point of my code is to have a series of text appear on the web page in a sequence on after the other. please can someone help me, any suggestions will be appreciated.

<html>
<head>
<script type="text/javascript">
function timedText() {
var t1=setTimeout("document.getElementById('displayDiv ').innerHTML+='2 seconds!<br>'",2000);
var t2=setTimeout("document.getElementById('displayDiv ').innerHTML+='4 seconds!<br>'",4000);
var t3=setTimeout("document.getElementById('displayDiv ').innerHTML+='6 seconds!'",6000);
}
</script>
</head>
<body>
<form>
<input type="button" value="Display timed text!" onClick="timedText()">
<div id="displayDiv">
</div>
<p>Click on the button above. It will tell you when two, four, and six seconds have passed.</p>
</body>
</html>
skat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Mar 11th, 2008, 20:01   #2 (permalink)
Junior Member
 
Join Date: Feb 2008
Location: Paris
Age: 31
Posts: 18
Re: how can i use my javascript code with my asp.net page

try onclick and not onClick...
then, there's an error in your javascript: setTimeout takes a function on the first argument, not a string... so just define a method
function _2seconds() {
document.getElementById('displayDiv ').innerHTML+='2 seconds!<br>';
}

and now, use the following line:
var t1=setTimeout(_2seconds, 2000);

I think that's much better.
magicben is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Mar 11th, 2008, 20:02   #3 (permalink)
Junior Member
 
Join Date: Feb 2008
Location: Paris
Age: 31
Posts: 18
Re: how can i use my javascript code with my asp.net page

And, of course, do the same for 4 and 6 seconds...
magicben is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Mar 11th, 2008, 20:03   #4 (permalink)
Junior Member
 
Join Date: Feb 2008
Location: Paris
Age: 31
Posts: 18
Re: how can i use my javascript code with my asp.net page

If you use a JavaScript framework, like prototype, you can bind data on methods you give as argument...
example:
var t1=setTimeout(myMethod.bind(2), 2000);
magicben is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Mar 14th, 2008, 06:11   #5 (permalink)
Junior Member
 
Join Date: Feb 2008
Location: Paris
Age: 31
Posts: 18
Re: how can i use my javascript code with my asp.net page

did it help you ?
magicben is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Mar 14th, 2008, 06:17   #6 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
Send a message via Yahoo to Monie
Re: how can i use my javascript code with my asp.net page

LOL, his last post was on last January and you still talking to him
He might be long gone or solved his problem in other place since we took 2 month to reply to his problem

I think he solved them already mate!
Now we can move on!
__________________

Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Mar 14th, 2008, 17:53   #7 (permalink)
Junior Member
 
Join Date: Feb 2008
Location: Paris
Age: 31
Posts: 18
Re: how can i use my javascript code with my asp.net page

ok, I move on
magicben is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Mar 14th, 2008, 17:57   #8 (permalink)
Junior Member
 
Join Date: Feb 2008
Location: Paris
Age: 31
Posts: 18
Re: how can i use my javascript code with my asp.net page

but it can help other buddies...
thanks indeed, I didn't see the post date
__________________
MagicBen - DynAjax project leader [http://www.dynajax.org]
magicben is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Mar 17th, 2008, 02:57   #9 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
Send a message via Yahoo to Monie
Re: how can i use my javascript code with my asp.net page

I'll help you look for this skat guy..
Great solution by the way
__________________

Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
For all Javascript Coding Experts, can you break down this code? BlackReef JavaScript Forum 12 Dec 10th, 2007 01:04
getting source code of a page mikedikta JavaScript Forum 2 Oct 14th, 2007 18:39
BB Code - JavaScript Input thing... How? JasonStanley JavaScript Forum 5 May 5th, 2007 10:46
Help required with javascript code trb1975 JavaScript Forum 1 Oct 20th, 2006 21:16
Javascript code ignored by Netscape/Firefox commodorejim JavaScript Forum 2 Oct 14th, 2006 10:13



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 20:47.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59