|
Post by kokenge on Mar 29, 2008 13:30:03 GMT -5
How do you display links into a DIV ID area.
Here is a very simple example. It displays data into the ID area without a link, and I can clear the area. However when I try a display with a link, it don't work..
What am I doing wrong???
link #nlnk, "[Test no Link]", [nlnk] html "<BR>" link #lnk, "[Test lnk]", [lnk] html "<BR>" link #clr, "[Clear]", [clr] html "<HR>" html "<DIV id=xxx></DIV>" html "<HR>" wait ' ========== no link [nlnk] html "<script> document.getElementById('xxx').innerHTML = '" html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0><TR><TD>" html "Test with no link" html "</TD></TR></TABLE>" html "';</script>" wait ' ========== link [lnk] html "<script> document.getElementById('xxx').innerHTML = '" html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0><TR><TD>" html "Test with link<BR>" link #l, "[link]", [link]
html "</TD></TR></TABLE>" html "';</script>" wait ' ========== clear [clr] html "<script> document.getElementById('xxx').innerHTML = '';</script>" wait
Thanks for the help.
|
|
|
Post by mackrackit on Mar 29, 2008 15:46:33 GMT -5
|
|
|
Post by carlgundel on Mar 31, 2008 9:51:02 GMT -5
It's very important to make sure that any HTML you inject is actually valid. Technically it really should be XHTML. Each tag should be properly closed and nested. Not doing this can have unpredictable results.
Sorry I've been quiet. It's tax season and I've been *really* busy.
-Carl
|
|
|
Post by Jerry Muelver on Mar 31, 2008 12:26:54 GMT -5
As far as I can see, the HTML is valid. The JavaScript innerHTML seems to choke on a link, ANY link, in called block. Replace the RB link with an HREF in an HTML statement, and the block fails the same way. Now, is the problem with the JavaScript, or with RB's handling of JavaScript's innerHTML call, or.... ?
|
|
|
Post by kokenge on Mar 31, 2008 17:14:59 GMT -5
I tried a HREF and it seems to work..
html "<P><A NAME='home'></A>home</P>" link #nlnk, "[Test no Link]", [nlnk] html "<BR>" link #lnk, "[Test lnk]", [lnk] html "<BR>" link #lnk, "[HREF lnk]", [href] html "<BR>" link #clr, "[Clear]", [clr] html "<HR>" html "<DIV id=xxx></DIV>" html "<HR>" wait ' ========== no link [nlnk] html "<script> document.getElementById('xxx').innerHTML = '" html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0><TR><TD>" html "Test with no link" html "</TD></TR></TABLE>" html "';</script>" wait ' ========== link [lnk] html "<script> document.getElementById('xxx').innerHTML = '" html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0><TR><TD>" html "Test with link<BR>" link #l, "[link]", [link] html "</TD></TR></TABLE>" html "';</script>" wait
' ========== link [href] html "<script> document.getElementById('xxx').innerHTML = '" html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0><TR><TD>" html "Test with link<BR>" html "<P><A HREF=""#home"">[home]</A>" html " " html "<A HREF=""nowhere"">[test]</A>" html "</TD></TR></TABLE>" html "';</script>" wait
' ========== clear [clr] html "<script> document.getElementById('xxx').innerHTML = '';</script>" wait
|
|
|
Post by lewiseason on Mar 31, 2008 18:16:33 GMT -5
It's very important to make sure that any HTML you inject is actually valid. Technically it really should be XHTML. Each tag should be properly closed and nested. Not doing this can have unpredictable results. Sorry I've been quiet. It's tax season and I've been *really* busy. -Carl Slightly off-topic, but: Does not using valid XHTML produce unpredictable results as it can normally, or specifically because it is part of a runbasic program? Thanks ~ Lewis
|
|
|
Post by kokenge on Mar 31, 2008 20:35:16 GMT -5
Actually this works also. The script tries to enclose everything in a single quote ('). I tried double quote ("). However the RunBasic link has both single and double qoutes in it. So I replace the single quotes with double quotes and this seems to work. link #l, "[link]", [link] html "<HR>" html "<DIV ID=xxx></DIV>" html "<script> document.getElementById('xxx').innerHTML = '" html "Test with link<BR>" html "<a onclick=""submitFormTriggeringCallback(""form1244"", ""2"", "href" ); " html "return false;"" id=""#l"" href=""?_s=zAoyVYVwGYDBNRRp&_k=TQMoQmqV&2"">[link]" html "';</script>" wait
Is there another way to enclose the stuff you want in a <script> besides quotes? Thanks for the help.
|
|
|
Post by Carl Gundel - admin on Mar 31, 2008 20:50:54 GMT -5
It's very important to make sure that any HTML you inject is actually valid. Technically it really should be XHTML. Each tag should be properly closed and nested. Not doing this can have unpredictable results. Sorry I've been quiet. It's tax season and I've been *really* busy. -Carl Slightly off-topic, but: Does not using valid XHTML produce unpredictable results as it can normally, or specifically because it is part of a runbasic program? Thanks ~ Lewis Invalid XHTML means broken tags, unmatched tags, incorrectly tags, etc. The browser isn't going to like it, and RB may not like it either. How can you expect a page with bad code in it to work ? -Carl
|
|
|
Post by Carl Gundel - admin on Mar 31, 2008 20:52:43 GMT -5
As far as I can see, the HTML is valid. The JavaScript innerHTML seems to choke on a link, ANY link, in called block. Replace the RB link with an HREF in an HTML statement, and the block fails the same way. Now, is the problem with the JavaScript, or with RB's handling of JavaScript's innerHTML call, or.... ? I'm not sure that <BR> is valid XHTML. Try <BR/>. Ditto for <P>. -Carl
|
|