Re: calling functions from cgi



RobG <rgqld@xxxxxxxxxxxx> wrote in
news:qGSDf.264$Nv4.46411@xxxxxxxxxxxxxxxxx: 

> Tony Rice wrote:
>> RobG <rgqld@xxxxxxxxxxxx> wrote in news:zvBDf.251$Nv4.46029
>> @news.optus.net.au:
>> 
>> 
>>>That sounds like you are trying to access elements before the page
>>>has created them, either onload or after the AJAX stuff.
>>>
>>>Code snippet?  URL?  
>> 
>> 
>> I'm using jah (http://microformats.org/wiki/rest/ahah) to load URLs
>> inline dynamically.  The perl script looks like this:
>> 
>> my $ajaxcall="jah('myotherscript.cgi?myarg=arg', 'contentdiv')";
>> if (param('myparam')){
>>   print "<script type=\"text/javascript\">$ajaxcall</script>\n";
>> 
>> }else{
>>   print a({href=>"javascript:$ajaxcall"}, 'click to load');
>> }
>> print "<div id='contentdiv'></div>\n";
> 
> Don't post server code, post what your client gets - this is a 
> JavaScript news group, not Perl :-)
> 
> What content is written to the script element?  What is written as the
> value of the A element's href attribute?  What is the surrounding
> HTML? 
> 
> I have no idea what is ending up in your A element attributes, so it's
> hard to help.  Use view source on the client to get the actual HTML
> that is delivered to your page (a minimal test case will do).

Sorry, thought it was obvious from that code snippet and it's important 
to show how the javascript is generated differently depending on the 
context.

The problem has been fixed by putting

<A HREF="javascript:jah('something.cgi', 'contentdiv')>click to load</A>

inside <div id='contentdiv'> rather than outside.

I have no idea why this fixed it.  This is the only change made but now 
I'm getting no further errors from getElementById when calling the ahah 
function directly.

>> The goal is to have the content loaded inline automatically if the 
>> 'myparam' is passed in the query string and make it loadable inline
>> by clicking the link.
>> 
>> 
>> I'm getting the following errors:
>> 
>> document.getElementById(target) has no properties
> 
> The value of 'target' should be the ID of an element on your page.  If
> the page hasn't finished loading (unlikely), or the ID doesn't exist 
> (much more likely), then you will get the error you get.

I checked that angle out as well.  didn't matter where the target div was 
placed in relation ship to the ahah call.

Not sure why it works not, but at least it works.  
.



Relevant Pages

  • Re: word 2007. Equation editor. Centered equation does not remain centered when SAVE AS HTML
    ... You can add the command 'Web Page Preview' to the Quick Access Toolbar ... I do NOT see an 'inline' option? ... I then do SAVE AS and select HTML. ... I then view the HTML page from a browser. ...
    (microsoft.public.word.application.errors)
  • Re: Viewing html inline files in Outlook
    ... When you specify that the attachment ... file is inline; that's how the file shows up as part of the mail's body. ... So I specify the same Java settings for both text and html ... >> Outlook Express will display the html file as part of the body of the ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Crippled or missing borders in IE 7
    ... point of HTML, but nowadays HTML is not supposed to describe ... Block-level, inline, and table-cell elements are not about ... you can have that, browsers will try to cope with this, ...
    (alt.html)
  • Re: phpmailer
    ... General I have a problem when attach embedded image used in html and ... attach another image as standalone attachment. ... (first is used in html body, ... In this mail there are two attachments, one is 'inline', the other is ...
    (comp.lang.php)