-
Voting javascript popup for website
Well,I had done that work for a mu server but I did it for free. The code is not mine but the graphics are ;) So I guess I have all the rights to make a guide about that since the code is free! :P
step 1.
You must add the following line in the HEAD tag of your mainpage:
Code:
<head>
....blah blah blah...
<script type="text/javascript" src="YOUR_PATH_HERE/votebox.js"></script>
</head>
step 2.
save the following code as a file with name "votebox.js" and put it in the folder you named as YOUR_PATH_HERE ( you get what i mean. I hope.. :p )
Code:
/******************************************
* Popup Box- By Jim Silver @ jimsilver47@yahoo.com
* Visit http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for use
******************************************/
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all
//drag drop function for NS 4////
/////////////////////////////////
var dragswitch=0
var nsx
var nsy
var nstemp
function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}
function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}
function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}
//drag drop function for ie4+ and NS6////
/////////////////////////////////
function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}
function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}
if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY
tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)
dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")
////drag drop functions end here//////
function hidebox(){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}
Now the system knows WHERE the file is and knows WHAT to do. But it does not know HOW and WHEN to do it. so we go to step 3.
Step 3.
Add right after the BODY tag of your html page (or the index.php page you have) the following code:
Code:
<div id="showimage" style="position:absolute;width:300px;left:90px;top:370px">
<table border="0" width="1000px" height="300px" bgcolor="#453734" cellspacing="0" cellpadding="2">
<tr>
<td width="100%">
<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0"
height="25px">
<tr>
<td id="dragbar" style="cursor:hand; cursor:pointer" width="100%" height ="22px" onMousedown="initializedrag(event)"><ilayer width="100%" onSelectStart="return false"><layer width="100%" onMouseover="dragswitch=1;if (ns4) drag_dropns(showimage)" onMouseout="dragswitch=0"><font face="Verdana" size="4"
color="#d9952b"><strong><small>Vote for us - If you experience problem of black page, download and run Firefox Browser</small></strong></font></layer></ilayer></td>
<td style="cursor:hand" height ="25px" ><a href="#" onClick="hidebox();return false"><img src="http://img214.imageshack.us/img214/2522/closeox4.gif" width="21px"
height="21px" border="0px"></a></td>
</tr>
<tr>
<td width="100%" align="center" valign="middle" bgcolor="#eeeedd" style="padding:4px" colspan="2">
<!-- PUT YOUR CONTENT BETWEEN HERE -->
<center>
<IFRAME SRC="http://digg.com" WIDTH="1000" HEIGHT="300"></IFRAME>
<!-- END YOUR CONTENT HERE -->
<!-- Credits for the layout and graphics: Laseen @ ragezone,
mail: Caveman_gr@yahoo_REMOVETHIS.com -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
Tadaaa! You are done! Instead of IFRAME you may add anything you want. Internet explorer freaks out with the IFRAME so you'd better use firerox of opera if you use that tag.
Now there is another tweak you must do if you have flash in your page. If there is flash loaded with the EMBED tag your votebox will not be drag-able. That happens because EMBED is not standard HTML. You have 2 choises:
1)either use standard XHTML for loading the flash objects you have
OR
2)make a quick&addition to the embed tag like that:
Code:
<embed name="movie" wmode="transparent" swliveconnect="true" src="YOUR_SWF_SOURCE" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="YOUR_HEIGHT" width="YOUR_WIDTH"></embed>
the extra addition is the wmode="transparent" part that makes your flash object go to the bottom layer of the browser's render ;)
If you dont use flash then obviously you dont have to make any flash-tweaking :P
Credits for the layout and graphics:
Laseen @ ragezone,
mail: Caveman_gr@yahoo_REMOVETHIS.com
Credits for code as referred in the votebox.js:
* Popup Box- By Jim Silver @ jimsilver47@yahoo.com
* Visit Dynamic Drive DHTML(dynamic html) & JavaScript code library for full source code
* This notice must stay intact for use
-
Re: [Guide] Voting javascript popup for website
-
1 Attachment(s)
Re: [Guide] Voting javascript popup for website
pffff.....:bomb:
I attach a sample file with all necessary code.... use that!
-
Re: [Guide] Voting javascript popup for website
What comes for blablabla... ?
-
Re: [Guide] Voting javascript popup for website
Try not being such an asshole next time...
It works, although PHP is still a better way to go. (and considering you didn't write the code you shouldn't be such an asshole about it)
Can easily disallow js and this won't work.
-
Re: [Guide] Voting javascript popup for website
well, for me didnt worked :S
-
Re: [Guide] Voting javascript popup for website
blah blah blah= TITLE, meta,other scripts .... ;)
smartass Lithic with PHP its *impossible* to do a floating iframe.
Yes its javascript, but if you disable the javascript you will not be able to do other javascript tasks e.g. reseting your character using mutoolz. So, think twice before speaking.
A way of blocking it, is adding the votebox.js to the blocked content of your browser. But its really so much easier to click the "X" button....
hermes the .zip works fine. Unzip it in a folder and open the .html file! You should get a floating frame of digg.com :)
-
1 Attachment(s)
Re: [Guide] Voting javascript popup for website
for me works :rofl:
/edit : i fixed it a little xD
-
Re: [Guide] Voting javascript popup for website
Quote:
Originally Posted by
Laseen
pffff.....:bomb:
I attach a sample file with all necessary code.... use that!
ok thx worked now-_- but u know what, you shouldnt start insulting ppl here because we're not all php coders, and you better go to physiatrist not me.
-
Re: [Guide] Voting javascript popup for website
this is js & html not php xD
-
Re: [Guide] Voting javascript popup for website
Quote:
Originally Posted by
Trolly_G-M
ok thx worked now-_- but u know what, you shouldnt start insulting ppl here because we're not all php coders, and you better go to physiatrist not me.
I visit one every Sunday. Do you need his address? ^_^
And btw, I dont believe i insulted you.
If someone should feel insulted is Lithic. :P
@silvers: nice dude!! :thumbup:
-
Re: [Guide] Voting javascript popup for website
Quote:
Originally Posted by
Laseen
blah blah blah= TITLE, meta,other scripts .... ;)
smartass Lithic with PHP its *impossible* to do a floating iframe.
Yes its javascript, but if you disable the javascript you will not be able to do other javascript tasks e.g. reseting your character using mutoolz. So, think twice before speaking.
A way of blocking it, is adding the votebox.js to the blocked content of your browser. But its really so much easier to click the "X" button....
hermes the .zip works fine. Unzip it in a folder and open the .html file! You should get a floating frame of digg.com :)
Mmhm...
Look around at other posts buddy, theres all kinds of PHP shit around here.
If anyone actually uses this then they are going to be disappointed because a lot of people in foreign countries use programs like Peer Guardian or they have cookies and JS blocked.
Not even worth the time to add it in if no one ever sees it now is it?
And most servers are using SQL and PHP, not javascript. So maybe you should think twice before posting.
Read the rules, no spamming other sites. Next time just show a blank box and not some gay ass site.
Quote:
Originally Posted by
Laseen
I visit one every Sunday. Do you need his address? ^_^
And btw, I dont believe i insulted you.
If someone should feel insulted is Lithic. :P
@silvers: nice dude!! :thumbup:
Why would I be insulted by a dumbass n00b?
Hmm....
Yea I'm not.
-
Re: [Guide] Voting javascript popup for website
You are retarted. And lack programming knowledge. Actually i believe you know a shit about programming. Its pointless to keep talking.
-
Re: [Guide] Voting javascript popup for website
gezz, can you guys stop?
anyway, thanks.
to those ppl who paid for this kind of shit, YOU JUST WASTING YOUR MONEY.
-
Re: [Guide] Voting javascript popup for website
Quote:
Originally Posted by
Liselotte
gezz, can you guys stop?
anyway, thanks.
to those ppl who paid for this kind of shit, YOU JUST WASTING YOUR MONEY.
Lmao they dont know how to use google....
-
Re: [Guide] Voting javascript popup for website
yep works perfect :P :D
but i hate tittle "use fire fox" :D
fire fox :'(
Opera :)
http://img267.imageshack.us/img267/4389/minehf1.th.jpg
-
Re: [Guide] Voting javascript popup for website
ppl dont vote if u force em... unless they are idiots lol XD
these scripts generally decrease server popularity...
-
Re: [Guide] Voting javascript popup for website
yeh RK thats right but some times people don't vote for u at all witch sux xD anyway good job
-
Re: [Guide] Voting javascript popup for website
Not bad but i daresay its bater :)
<SCRIPT language=JavaScript type=text/javascript>
<!--
var detStatus=confirm("Plz Vote !");
if (detStatus)
window.location = "http://mu.hopzone.net/vote.php?site=6161";
else
document.write("");
//-->
</SCRIPT>
-
Re: [Guide] Voting javascript popup for website
How do i make it so the links that you click on in the java window open in a new tab or window.
-
Re: [Guide] Voting javascript popup for website
works! and yes, this is html, not php eh :scratch:
-
Re: [Guide] Voting javascript popup for website
my box kicks ur box our of the water. ^^
this js script is kinda outdated lol
-
Re: [Guide] Voting javascript popup for website
john.? release source? or new pop-BOX
-
Re: [Guide] Voting javascript popup for website
ill make something later ^^
-
Re: [Guide] Voting javascript popup for website
doesn't work for my web...
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\index.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\index.php on line 4
-
Re: [Guide] Voting javascript popup for website
Laseen you got your first warning.
And btw, nice guide.
-
Re: Voting javascript popup for website
hey, where should i put that code?? i tried adding it in advertisement but its not working
-
Re: Voting javascript popup for website
nice good job ! it works but i have small question, what if i want to make the website ( not the votebox) not so visible , to change the contrast like this TinyBox - JavaScript Popup Script
i hope you know what i mean! pls tell me