News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Adding Javascript to homepage

Started by dfin, December 15, 2014, 21:11:28 PM

Previous topic - Next topic

dfin

If this is in wrong section, forgive me.

I'm wanting to add a pop-up window to the homepage, & have resorted to trying to add a custom html module called 'myJavacript' & assigning it to the homepage there...problem is, the code is stripped out & some tries results in  being written out on the page versus sticking to a backend code to be read.

In the html editor, in the code portion...I put either
Quote<?php
$document = JFactory::getDocument();
$document->addScriptDeclaration('
    window.open ('popup.html', 'newwindow', config='height=550, width=600, toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no');
    );
');
?>

or plain old
Quote<SCRIPT LANGUAGE="javascript">

window.open ('popup.html', 'newwindow', config='height=550,

width=600, toolbar=no, menubar=no, scrollbars=no, resizable=no,

location=no, directories=no, status=no')

</SCRIPT>

First way writes the middle code out & last way does nothing....what am I doing wrong & is there another method to go about this?

Thank you.
I have VirtueMart 2.6.6 & I manually updated for 2.6.10  |  Joomla 2.5.28 | Php 5.4.27

dfin

I added an extension to not strip the code....so now the text editor in a module I made has...
Quote{source}

<?php
$document = JFactory::getDocument();
$document->addScript('http://website.com/MY-JS.js');
?>

{/source}
Then in the MY-JS.js I have a function to open a new window...& it still isn't working?
I have VirtueMart 2.6.6 & I manually updated for 2.6.10  |  Joomla 2.5.28 | Php 5.4.27

dfin

I have VirtueMart 2.6.6 & I manually updated for 2.6.10  |  Joomla 2.5.28 | Php 5.4.27