473,326 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Dynamically generating Javascript

Here's my scenario:

I have one page, one control, and I want the control to generate a
javascript to the page based on parameters passed by the queryString.

ASPX Code:
....
<head>
<title>TItle</title>

<uc1:MyControl ID="myControl1" runat="server" />

<script type="text/javascript">
function function2(id,myText){
document.getElementById(id).innerHTML=myText
}

function function3(id,myText){
document.getElementById(id).innerHTML=function1(my Text)
}
</script>
....

The output of "myControl1" is the javascript called "function1", which is
called by function3

But for some reason it does not work, I get the "Object expected" error in
javascript (can't find function1).
I'm assuming it has to do with the page life-cycle but I have no idea.
Any help will be very appreciated.

Thanks,
Fernando
Sep 1 '06 #1
1 1138
look at the page source. also check that the ids passed to functions match
the rendered ids.

-- bruce (sqlwork.com)

"Fernando Chilvarguer" <fe******@no-spam-impex.comwrote in message
news:eb**************@TK2MSFTNGP04.phx.gbl...
Here's my scenario:

I have one page, one control, and I want the control to generate a
javascript to the page based on parameters passed by the queryString.

ASPX Code:
...
<head>
<title>TItle</title>

<uc1:MyControl ID="myControl1" runat="server" />

<script type="text/javascript">
function function2(id,myText){
document.getElementById(id).innerHTML=myText
}

function function3(id,myText){
document.getElementById(id).innerHTML=function1(my Text)
}
</script>
...

The output of "myControl1" is the javascript called "function1", which is
called by function3

But for some reason it does not work, I get the "Object expected" error in
javascript (can't find function1).
I'm assuming it has to do with the page life-cycle but I have no idea.
Any help will be very appreciated.

Thanks,
Fernando

Sep 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: natkhatbandar | last post by:
Hi, I am generating an XML document dynamically using DOM. I am creating an element using IXMLDOMDocument::createElement() and then calling IXMLDOMElement::appendChild() for the parent element....
5
by: mikeyjudkins | last post by:
Ive been banging my head on the wall for hours with this one, hopefully someone will know what Im doing wrong here :\ The Goal: I have an xml file that is generated on the fly via JSP which I...
1
by: Jon | last post by:
I need to generate an XML File dynamically using ASP and a SQL Database. I don't have time to learn php or any other programing language. I need a ASP page to either append information to an XML...
3
by: Volker Hetzer | last post by:
Hi! I'm new to javascript and I'd like to know whether javascript can process javascript-code entered by the user or read from a file. We've got an application that uses ActiveX as main...
2
by: James Black | last post by:
I am dynamically generating a table in IE to display some information. I will probably change it to divs later, but I just want to get it working properly first. In my div I have the following...
4
by: somaskarthic | last post by:
Hi I posted query about dynamically generating php code. Sorry for the inconvenience . I didn't given you the php code. Its just javascript code which dynamically create rows on button click event....
2
by: aric.bills | last post by:
Hello all, I'm a novice Javascript programmer, and I'm having browser compatability issues regarding dynamic generation of tables. The following content generates "hello" in Firefox 1.5, but...
1
by: jeffejohnson | last post by:
I'm looking to see if anyone has experienced this... I've got a dropdown that I'm populating dynamically and the items include HTML special characters (like &Ocirc;). If I load them from an...
0
by: krish | last post by:
hi, I am dynamically generating Imagebutton (say 5 imagebutton, in loop) . for each imagebutton url , i am dynamically generating image and assigining to it. every thing is ok upto this...
11
by: Faisal Vali | last post by:
Are there any guidelines people use that help them decide when it is better to dynamically generate all html elements using javascript versus actually writing some html and using it as scaffolding?...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.