PC Review


Reply
Thread Tools Rate Thread

Call javascript function without using any event call

 
 
cschang
Guest
Posts: n/a
 
      31st Jan 2005
In my vb.net module, I used the script to generate a client side
javascript function. as
Private Sub disablePostedFileInout(ByVal n As Integer)
Dim jScript As String

jScript = "<script language='javascript'>"
jScript = jScript & " function disableInput(" & n & " ) { "
jScript = jScript & " var j = 0; "
jScript = jScript & " for( var i =0; i<
document.form1.elements.length; i++){"
jScript = jScript & " if( document.form1.elements[i].type
=='file') { "
jScript = jScript & "
document.form1.elements[i].style.visibility = 'hidden'; "
jScript = jScript & " if ( (j + 1) == " & n & " ) return; "
jScript = jScript & " } ) } "
jScript = jScript & "</script>"

If (Not IsClientScriptBlockRegistered("clientScript")) Then
RegisterClientScriptBlock("clientScript", jScript)
End If

End Sub

Is possible I can just call the javascript function "disableInput"
without associating it in any event of the control such as button or
input as some kind of onclick, onchange etc? I want to run it from
another sub of the module

C Chang
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Ui4gVGhvbWFzLCBha2EgWHRyZW1lLk5ldA==?=
Guest
Posts: n/a
 
      31st Jan 2005
Yea... Just register the script...
R. Thomas
 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      31st Jan 2005
Cshang,

The answer is as R.Thomas already wrote that you can use the
registerstartupscript. Here the link how to use that

http://msdn.microsoft.com/library/de...cripttopic.asp

I think it is next time better to ask this kind of questions in the
newsgroup.

Aspnet
news://msnews.microsoft.com/microsof...amework.aspnet

Web interface:
http://communities2.microsoft.com/co...amework.aspnet

Or one of the language newsgroups

I hope this helps

Cor


 
Reply With Quote
 
cschang
Guest
Posts: n/a
 
      1st Feb 2005
Cor Ligthert wrote:

> Cshang,
>
> The answer is as R.Thomas already wrote that you can use the
> registerstartupscript. Here the link how to use that
>
> http://msdn.microsoft.com/library/de...cripttopic.asp
>
> I think it is next time better to ask this kind of questions in the
> newsgroup.
>
> Aspnet
> news://msnews.microsoft.com/microsof...amework.aspnet
>
> Web interface:
> http://communities2.microsoft.com/co...amework.aspnet
>
> Or one of the language newsgroups
>
> I hope this helps
>
> Cor
>
>

Thanks, Cor. I will go to those links to check out. I started to learn
the .net (mainly by vb.net) because of the work, just starting off right
before las Xmas. So I have not much idea where I can post my questions.

C Chang.
 
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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call a Javascript function from C# Praveen Microsoft C# .NET 7 1st Sep 2008 11:51 AM
Call a javascript when i call an aspx page with a form html not running on server Fabio Mastria Microsoft ASP .NET 4 28th Jan 2008 09:05 AM
[NEWBIE] Call an event from a javascript teo Microsoft ASP .NET 9 14th Sep 2006 10:13 PM
Call a javascript function from C# Praveen Microsoft C# .NET 2 24th Feb 2005 10:06 PM
How To Call Javascript function in asp.net hrishikesh Microsoft ASP .NET 1 15th Jan 2004 06:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:04 PM.