Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 823201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:54:55+00:00 2026-05-15T02:54:55+00:00

How can I register a javascript code a page? I want to put th

  • 0

How can I register a javascript code a page?

I want to put th javascript function to the aspx.page;
I thing it might be like that;

   string strJS= "<script language = javascript>

        (function(images, elements) {
            var fetchImages = function() {
                if(images.length > 0) {
                    var numImages = 10;
                    while(images.length > 0 && numImages-- > 0) {
                        // assuming your elements are <img>
                        document.getElementById(elements.shift()).src = images.shift();
                        // if not you could also set the background (or backgroundImage) css property
                        // document.getElementById(elements.shift()).style.background = "url(" + images.shift() + ")";
                    }
                    setTimeout(fetchImages, 5000);
                }
            }

            // bind to window onload
            window.onload = fetchImages;
            // if you're going to use something like jquery then do something like this instead
            //$(fetchImages);
        }(['url1', 'url2', 'url3'], ['img1', 'img2', 'img3'])) </script>";

Page.ClientScript.RegisterClientScriptBlock(typeof(ui_SUBMVGInfo), "SmartPenCheck", strJS);

The second Questin is;

  ...
... 
    g(ctrlIDBirthPlaceCode).onchange();

     }}
     </script>
     <script language = javascript>
     var url1 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Adiniz';
     var url2 ='http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Soyadiniz';
     var url3 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_tarih';
     var url4 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Adiniz';
     var url5 ='http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Soyadiniz';
     var url6 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_tarih';
     var url7 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Adiniz';
     var url8 ='http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Soyadiniz';
     var url9 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_tarih';
     var url10 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Adiniz';
     var url11 ='http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Soyadiniz';
     var url12 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_tarih';
    function(images, elements) {var fetchImages = function() 
    {if(images.length > 0) {var numImages = 5;
    while(images.length > 0 && numImages-- > 0) { document.getElementById(elements.shift()).src = images.shift();
     }setTimeout(fetchImages, 5000);
    }}window.onload = fetchImages;
    }(['+url1+', '+url2+', '+url3+','+url4+', '+url5+', '+url6+','+url7+', '+url8+', '+url9+','+url10+', '+url11+', '+url12+'], ['ui_taskFormControl$ctl03$ctl00$ctl03$ui_CustomerNameImage', 'ui_taskFormControl$ctl03$ctl00$ctl03$ui_CustomerSurNameImage', 'ui_taskFormControl$ctl03$ctl00$ctl03$ui_MaritalStatusImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_SexImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_BirthDateImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_BirthPlaceCodeImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_BirthPlaceImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_IdNationalityImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_MotherOldSurNameImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_TaxNoImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_CitizenshipNoImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_HomePhoneImage']));
     </script>

     <script>
    var ui_BirthPlaceCode_a='Intertech.Utility';
    var ui_BirthPlaceCode_c='Intertech.Utility.Common';
    var ui_BirthPlaceCode_sbn='';
...
..

What do you think is it allright or how can I do that?
And according to second question above; the use of the code is correct?
ref:**

PS: To see my purpose please continue reading below;

There is a web site page which is
coded on asp.net with using c# and
ajax is enabled too.

I want a very fast loading web page;
which is going to happen with the
following architecture;

1- First all data is shown by the text
boxes (There are 50 text boxes, it is
an application form.)

2- When the web Page is requested and
loaded, then I want all the photos are
shown near the each text boxes 10 by
10 from top of the page till the end
of it. (Each photo is between 5 kb –
20 kb; )

I know ImageHandler’s the question is
how can I put all these idea into real
life? some examples and ideas will be
great ! thanks
This issue has been answered and you may have a look -> here

Regards
Bk

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:54:56+00:00Added an answer on May 15, 2026 at 2:54 am

    Are you asking if your script will work, or are you asking if this is a good way to add it to the page?

    Inserting the script in to the page in that way will certainly work, but best practice would say you do a check first:

    if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "SmartPenCheck"))
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "SmartPenCheck", strJS, false);
    

    Doing it this way though is a little messy. You cannot replace the script without recompiling the app. You don’t get the caching you would have from having it in a separate javascript file. It is a lot harder to debug. It is messy to read in the .cs file.

    You want to save this method of adding javascript for when you need to insert dynamic values into the javascript (like control IDs), or you need to change which script is inserted based on some other criteria.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked at their help page it seems like I can register a
I made a form so that users can register their email address for a
I've a website where users can register. I would like to prevent all special
I want to make a WCF timer service where clients can register in order
I want to build a web application where users can register and have a
I have an ASP.NET user control that I want to write some dynamic Javascript
I have the following code: <script type=text/javascript> function SubmitForm() { form1.submit(); } function ShowResponse()
I've added in an .aspx page some JS code based on jQuery , but
I want my page to output like this: But instead it comes out like
This is my jquery and javascript code : <script type=text/javascript> $(document).ready(function () { //setup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.