|
Web design and Programming Discuss website creation and other programming topics. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||
|
Is there a script to do this?
You know those games on the net where it says something like:
"Do not click this button" ... Then you click the button... Then it says: "No, do not click this button." ... Then you click it, and another message pops up, etc. Is there a script that does this? I was thinking I use a script on a page that does that and you can type in the text strings for it. Does it require the use of JavaScript? Thanks guys. Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black |
#2
|
||
|
its javascript
alert.show("Do not click this button"); alert.show("I told you not to click that button"); |
#3
|
||
|
Oh okay. So I put this in e.g: a file called "script.js" - but how would I execute it in my HTML/XHTML document?
I'll try Googling if I get no answer (once I get back home from school). Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black |
#4
|
||
|
I think you do a thing like:
<body onload="init()"> then put the alerts in a funtion for example this function would be function init() { alert.show("Do not click this button"); alert.show("I told you not to click that button"); }
__________________
|
#5
|
||
|
all you have todo is either
<script type=javascript> alert.show("blah"); </script> or just (if wanting to use a js file) <script src="annoy.js"> </script> in your html It will automatically execute the javascrip in the scripts when the page loads. IcI |
#6
|
||
|
fine ici, make me feel like an idiot. Thanks!
__________________
|
#7
|
||
|
lol - you way would work but you would still have to do one of the 2 ways I posted, and the function would have to be declared in the header, otherwise <body onint="int()"> won't know what function int() is ie:
Code:
<html> <head> <script script type="text/javascript"> function annoy() { alert.show("Blah"); } </script> </head> <body onint="annoy()"> </body> And in correction to my first reply - the correct script mark up is <script type="text/javascript"> </script> |
#8
|
||
|
It ain't working. I tried every way there was but nothing. Tested in IE6 and FF.
Also, is there some way (when it works), I can set the page up so that there's some normal paragraphed text then the button down bottom that says "Do Not Click"? Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black |
#9
|
||
|
post the code
|
#10
|
||
|
Code:
<script type=javascript> alert.show("blah"); </script> Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black |
#11
|
||
|
yes, it needs to be a properly formed html page - you don't need the <head></head> tags but you do need the rest:
Code:
<html> <body> <script type=javascript> alert.show("blah"); </script> </body> </html> |
#12
|
||
|
Still ain't working in IE/FF.
However, it does say (like last time) that IE has blocked something from running on the page. When I allow it, nothing happens still. Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black |
#13
|
||
|
sounds like the page is being run in restricted mode, which disables javascript. - I run into that alot, but haven't found out how to tell it not to run the page in restricted mode.
|
#14
|
|||
|
Quote:
Is there some alternative way to do this (this as in, the button clicking game thing), like in HTML somehow? I was gonna look at the source code at the site that inspired me to do it - but the link to it is down... :/ Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black |
#15
|
||
|
my bad, didn't have the code right:
Code:
<html> <body> <script language="Javascript"> alert ("blah") </script> </body> </html> |
#16
|
||
|
It worked. Thanks man.
But what I was kinda looking for was more of a button on a page rather than an alert window popping up. And I'm able to add text above the button on the page, etc. Thanks again mate, anyway. Chris
__________________
Intel Core Duo E7300 2.66GHz // SuperTalent DDR2 800 2GB // ASUS nVidia GeForce 8400GS 512MB // Western Digital 7200RPM 320GB SATA // LG GH-20LS 20X SATA DVD-RAM // Windows XP Pro 32-bit // Thermaltake XP550 NP 430W // Thermaltake SOPRANO SECC Black |
#17
|
||
|
Code:
<script type="text/javascript"> var answer = confirm ("Do you want to continue?") if (answer) alert ("You answered Ok!.") else alert ("You answered Cancel.") </script> |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PHPBB Script | Jeff | Web design and Programming | 18 | 09-30-2005 10:42 AM |
tutorial script | atholon | Web design and Programming | 16 | 07-23-2005 10:31 PM |
old script | Djinn | phphq.Net Forums | 3 | 03-25-2005 11:14 AM |
mail script | PHP-Largo | phphq.Net Forums | 2 | 10-19-2004 09:49 PM |
My First Script :) | EDGE | Web design and Programming | 13 | 07-05-2004 02:56 PM |