js code not working.
-
Its a great plugin.I was looking for something like this for some time now.
I have placed a button on my homepage and has written the javascript code in your js editor.
But, the code is not taking effect. Not sure what wrong.
-
Could you show me your js code?
In current version, please don’t use // comment style; use jQuery instead of $. I hope it will help you.
If your code still not working, please contact me: [email protected]
Hi,
Sure. This is my js code.
function myImg(){ window.name = "thiswin"; newwin=open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin", "width=750,height=300,scrollbars=no, menubar=no"); }This code is to open the link in a new window.
function myImg(){ window.name = "thiswin"; newwin = window.open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin", "width=750,height=300,scrollbars=no, menubar=no"); }I modified your code, please try it.
Still. no success.
Could you give me your website link? If you do not want to public it, you can send to my email: [email protected]
You should add onclick=”myImg()” to the button. Like this:
<a onclick="myImg()" href="javascript:void(0);" target="_self" class="gdl-button small" style="color:#fff; background-color:#ff7000; border-color:#cc5a00; ">LISTEN HERE</a>
I use href=”javascript:void(0);” instead of URL to prevent browser go to that URL.<p style=”text-align: center;”>[button color=”#fff” background=”#ff7000″ size=”small” onclick=”myImg()” href=”javascript:void(0);” src=”http://185.105.4.132/~zen/player/zenradio.html” target=”_blank”]LISTEN HERE[/button]</p>
This is my button code.
I see… You have to add ID to the button, and then use jQuery to set onclick action. Change your button to:
<p style="text-align: center;">[button color="#fff" background="#ff7000" size="small" id="listenhere" src="javascript:void(0);" target="_self"]LISTEN HERE[/button]</p>then add this to Custom Javascript:
function myImg(){ newwin = window.open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin", "width=750,height=300,scrollbars=no, menubar=no"); } jQuery('#listenhere').click(myImg());nothing is happening. Button is not working.
Change JS to below code, notice the ; (semicolon) after myImg function.
function myImg(){ newwin = window.open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin", "width=750,height=300,scrollbars=no, menubar=no"); }; jQuery('body.home .gdl-button').click(myImg());and make sure your browser allows popup (very important if you want to open in new window).
nope. still doesn’t work.
function myImg(){ newwin = window.open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin", "width=750,height=300,scrollbars=no, menubar=no"); }; jQuery('body.home .gdl-button').click(function() { myImg(); });Please copy exactly this code. body.home and .gdl-button have spacebar between
yes, thats exactly what I was doing.
anyway, it works now.
Thank god, It works, haha.
Today I’m feeling so confused, made too many mistakes. Sorry for wasting your time 🙁
The topic ‘js code not working.’ is closed to new replies.