r5 - 01 May 2008 - 08:03:21 - PeterThoenyYou are here: TWiki >  Support Web > ProblemWithScriptTagInTwiki4
Tags:
, create new tag

Question

hey,

In twiki3 I used to include:

<script type="text/javascript">
...code
</script>
on top of the editable part of the page and then referring to the proper function.

I want the script to be processed on client site. In twiki3 I just use

<script>Function(paramethers)</script>
to call a function on a page. In twiki4 this doesn't work unless I put <pre></pre> tags around
<script>Function(parameters)</script>
Is there a way to keep the old way in twiki4? I don't know where this can be configured.

Thanks a lot

Environment

TWiki version: TWikiRelease04x01x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: unix
Web server: apache 2
Perl version: 5.8
Client OS:  
Web Browser:  
Categories: Javascript
-- GrazynaGladys - 19 Mar 2008

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

I do not think this is configurable. This is what I typically use to avoid interference by the TWiki rendering engine:

<script type="text/javascript">
<!-- Hide JavaScript and <pre> escape TWiki rendering
... your JavaScript goes here...
// Stop hiding and stop </pre> escaping TWiki rendering -->
</script>

This should work across all TWiki versions.

-- PeterThoeny - 21 Mar 2008

Peter,

I created a page wit this content:

<script type="text/javascript">
<!-- Hide JavaScript and <pre> escape TWiki rendering
function logFiles(strServer)
{
 document.write( "Logfiles".link("javascript:OpenPopup('file://" + strServer + "/LogFiles','width=600,height=650,top=20')") );

}

// Stop hiding and stop </pre> escaping TWiki rendering -->
</script>

---++ TWiki3
|*Host*|*Log Files*|
|server1|<script>logFiles("server1")</script>|
|server2|<script>logFiles("server2")</script>|
|server3|<script>logFiles("server3")</script>|


---++ TWiki4
|*Host*|*Log Files*|
|server1|<pre><script>logFiles("server1")</script></pre>|
|server2|<pre><script>logFiles("server2")</script></pre>|
|server3|<pre><script>logFiles("server3")</script></pre>|

This how the page renders using TWiki3
script_twiki3_render.gif

This how the page renders using TWiki4
script_twiki4_render.gif

Basically the TWiki4 version works, but the rendered page looks not really good. I tried using

|server3|<pre><script></pre>logFiles("server3")<pre></script></pre>|
That does not work at all.

Any tips how to solve this?

Thanks

Claus

-- ClausLanghans - 27 Mar 2008

Sorry, closing this question after more than 30 days of inactivity. Feel free to re-open if needed.

-- PeterThoeny - 01 May 2008

 
Change status to:
Topic attachments
I Attachment Action Size Date Who Comment
gifgif script_twiki3_render.gif manage 9.6 K 27 Mar 2008 - 19:23 ClausLanghans  
gifgif script_twiki4_render.gif manage 7.9 K 27 Mar 2008 - 19:23 ClausLanghans  
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r5 < r4 < r3 < r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo