jeffreyhi1 / jscrollpane

Automatically exported from code.google.com/p/jscrollpane
0 stars 0 forks source link

Cannot embed JavaScript inside the pane (FF3) #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use Mozilla Firefox 3
2. Create a JScrollPane containing any text
2. Insert the following code anywhere inside the pane : <script
type="text/javascript">document.write('<br>Hello world !<br>')</script>
3. Try to display the resulting page

What is the expected output?
The string "Hello world !" should appear in the middle of the text.

What do you see instead?
The whole page is discarded, and replaced by the only generated text, so
you can see only "Hello world !" in black on a white background

What version of the jScrollPane are you using?
jScrollPane-1.2.3.js (Dec 10 2008)

On what browser?
Mozilla Firefox 3.0.10

And operating system?
Windows XP SP3

Please provide a URL to a page displaying the problem.
http://www.shaoyao.fr/index_with_bug.php?page=contacts
(this is made from the actual page on which I tried to embed JavaScript
antispam protection inside the pane)

Please provide any additional information below.
I need to include email addresses with JavaScript antispam protection
inside the pane.

Original issue reported on code.google.com by from_goo...@nospam.homelinux.org on 24 May 2009 at 9:52

GoogleCodeExporter commented 9 years ago
Hi,

I think this is more of a problem with using document.write rather than with
jScrollPane...

Instead you could use jQuery's dom methods... I can't load your page at the 
moment
but something like this should work:

<code>
var emailAddress = 'ass@assa.com'; // or however you calculate your email 
address
$('#id_of_element_to_put_email_address_in_to').text(emailAddress);
</code>

Hope that helps,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 30 May 2009 at 8:13

GoogleCodeExporter commented 9 years ago
even using the dom code the ouput is buggy
For Example: trying to output a hidden form element (<input type=hidden 
name=EQUATION value=35 >) results in that text for the element being displayed 
publicly and not how we want which is to hide it.

the problem is with using these output properties with jquery.
document.write is a base level command that should always work but with this 
jquery 
package loaded on pages it does not work and cause the bad display.  using 
jquery's 
dom to output text is fine but as for outputtin code it still does not work

Original comment by pe...@seoexpert.com on 17 Aug 2009 at 7:25

GoogleCodeExporter commented 9 years ago
It doesn't sound like your problem is with jScrollPane but rather with jQuery. 
I'd
recommend joining the jQuery group and asking your questions there:

http://groups.google.com/group/jquery-en/

To output html using jQuery you may want to use the .html() method e.g.

<code>
$('#id_of_element_to_put_email_address_in_to').html('<input type="hidden" 
name="EQUATION" value="35" />');
</code>

Note that it will help if the HTML you are trying to insert is valid...

Original comment by kelvin.l...@gmail.com on 17 Aug 2009 at 10:57